Writing a blog after not quite a long time :D. Well, these days I went back in to working in MOSS 2007 that to working in an ASP.NET application for the first time.
After finishing the development of the application in the development server, I was able to successfully host in the QA server too with the help of my support team. But, when I hosted it in the Production server after having a huge argument with one of my support team members about the deployment process, I was getting this exception saying “The Web application at https://xnet.com/sites/CPAP/default.aspx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application“. Exception Message: FileNotFoundException.
I know that this error comes in a SharePoint 2010 environment when you execute a console application accessing a SharePoint site is in 32 bit instead of 64 bit mode. But, I was wondering how could this exception come in MOSS 2007 environment that too in a console application, that too when you are trying to host an ASP.NET application.
Was getting perplexed like anything even after googling where few blog posts tell to try with a different URL of SharePoint site sing Alternate Access Mapping.
After lots of debugging and redeployment, we found that by selecting the properties of the virtual directory created for the web application was running under the Default App Pool instead of the SharePoint Application’s App Pool as shown below.
So, whenever you get an exception like this in your web application, make sure that your application is running under the correct App Pool. I was finally able to make the application up and running by changing the App Pool as shown below.