开发者

Problem when porting to IIS 7.5

开发者 https://www.devze.com 2023-03-05 19:33 出处:网络
I got an ASP.NET app from someone who used to run it on his IIS on Windows XP (I don\'t know which IIS version he has).

I got an ASP.NET app from someone who used to run it on his IIS on Windows XP (I don't know which IIS version he has).

When I tried to deploy it on my IIS (v7.5 - Windows 7) - I can't open its default.aspx file and I get the f开发者_开发问答ollowing error page:

HTTP Error 500.19 - Internal Server Error

Error Code 0x80070021

Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". Config File \?\C:\inetpub\wwwroot\web.config

Config Source:

82:</modules>

83:<handlers> <-- This is the problematic line

84:    <remove name="ScriptHandlerFactory"/>

Any idea what I need to 'fix' in the web.config? Is there any guide to porting apps to iis7.5?


This happens when the site is seen as sub-folder of another application, not an ASP.NET application on its own.

If you just put it under wwwroot, you need to right click the folder you added in IIS not Explorer and choose "Convert To Application".

Alternatively right click "Sites" and add new site pointing to this folder, or under Default Web Site, choose Add Application... and point to the folder.

When you do this, there is "Application Pool" to select. Make sure that you choose one that has the .NET version the app was created for, If ASP.NET 1.x to 3.5 you choose ASP.NET 2.0, for .NET 4.0, you choose 4.0.


Make sure you troubleshoot the errors according to Microsoft articles like this one,

http://blogs.iis.net/webtopics/archive/2010/03/08/troubleshooting-http-500-19-errors-in-iis-7.aspx

There are usually a few more lines in that error response that points to the exact line in the config file (and hence the locked section) that has the problem. You will either have to unlock that section or not use it in your application’s web.config file. For e.g., one can lock/unlock handlers/modules sections by either Ø use appcmd.exe %windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers %windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/modules OR Ø manually change value from "Deny" to "Allow" for below settings in %windir%\system32\inetsrv\config\ applicationHost.config You can also configure the locking via IIS manager UI. For more details refer: Locking in IIS 7.0 Configuration In above error message, the error occurred on the handlers section at: ” This usually indicates that ASP.NET is either not installed or has corrupted/incomplete installation because installation of asp.net unlocks that section. Hence if this is the case, one should install asp.net feature from Server Manager (Under Web Server Role in Windows Server 2008 and in Program Features-> Application server in Vista/Windows7). This KB929772 talks about the ASP.NET installation failure reason.

0

精彩评论

暂无评论...
验证码 换一张
取 消