How to get a .Net 4.0 app to coexist as an application under a SharePoint 2007 website in IIS v7

.net-4.0sharepoint-2007

I have created a small .Net 4.0 website and installed it on my SharePoint server as a separate web site in IIS v7 (using port 8008 for now). I had to install the .Net 4 framework, set up the database, etc. and this all went smoothly and my app works as a standalone website.

Now I am trying to get pages from my website to show up in SharePoint 2007. For various reasons (the SharePoint site is using SSL, security, etc.) I now need to move my .Net app to run under the SharePoint 2007 site in IIS. I have added it as an 'Application' and set it up with the same .Net v4 application pool and settings that were working when it was set up as a standalone site.

Now when I try to access the application I get the error at the end of this description. Any help would be greatly appreciated. I already tried following the instructions on this post:

http://blogs.msdn.com/sgoodyear/archive/2007/05/07/custom-web-applications-coexisting-with-sharepoint-2007.aspx

but that did not help.

Here are the error details:

Log Name:      Application
Source:        ASP.NET 4.0.30319.0
Date:          11/05/2010 11:49:31 AM
Event ID:      1310
Task Category: Web Event
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      GGI-SP1.ggi.ca
Description:
Event code: 3008
Event message: A configuration error has occurred.
Event time: 11/05/2010 11:49:31 AM
Event time (UTC): 11/05/2010 3:49:31 PM
Event ID: 559d7ac619344f3499a4a31c6c9e58cd
Event sequence: 1
Event occurrence: 1
Event detail code: 0

Application information:
    Application domain: /LM/W3SVC/1653978112/ROOT/bidmonitor-1-129180665715766107
    Trust level: 
    Application Virtual Path: /bidmonitor
    Application Path: C:\inetpub\wwwroot\bidmonitor\
    Machine name: GGI-SP1

Process information:
    Process ID: 5272
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:
    Exception type: ConfigurationErrorsException
    Exception message: Could not find permission set named 'ASP.Net'.
   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)



Request information:
    Request URL: gginet.ggi.ca/bidmonitor
    Request path: /bidmonitor
    User host address: 10.10.1.33
    User: 
    Is authenticated: False
    Authentication Type: 
    Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:
    Thread ID: 3
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

Best Answer

Officially I don't think this configuration is supported yet. See the ASP.Net 4 breaking changes whitepaper.

Unofficially, you should be able to fix the problem by changing the trust level in your web.config file from WSS_Minimal to Full. This is NOT recommended though.