ASP.NET, MOSS and App Pool identities

 I recently had question from my friend that is using ASP.NET and MOSS on the same server. He had issue similar to this:

He has developed ASP.NET web application that is opening MOSS site using object model, with

SPSite site = new SPSite("SOMEURL");


and he had an issue that in debug mode using Visual Studio web server everything was working ok, but when application is deployed on IIS, he couldn't open MOSS site, with following error:The Web application at SOMEURL 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.

That is caused by the fact that by default ASP.NET and WSS Application Pools are running under different identities, even on same IIS. SO, one workaround we found was to simply change ASP.NET Application Pool so that it is run under same identity as MOSS, like this:

  1. Start IIS Manager2. Open Application Pools in left tree view3. Open properties window for WSS application pool (Right click... properties)4. Write down identity that this application pool is running under (on Identity tab) and then close this properties window5. Now, open properties window for ASP.NET application pool (Right click... properties)6. Select same identity as on WSS application pool (on Identity tab) and click OK7. Restart IIS.