将ASP.NET MVC应用程序部署到Web主机时由于配置锁定导致的内部服务器错误

时间:2022-11-24 08:31:36

I'm developing an ASP.NET MVC website on a local Windows Server 2008/IIS7 machine and am I'm now attempting to deploy it to my web host provider, ASPnix. I'm using their Shared Web Hosting service and have been placed on an IIS7 server which they claim supports ASP.NET MVC.

我正在本地Windows Server 2008 / IIS7计算机上开发ASP.NET MVC网站,我现在正尝试将其部署到我的Web主机提供程序ASPnix。我正在使用他们的共享虚拟主机服务,并被放置在他们声称支持ASP.NET MVC的IIS7服务器上。

However, when I deploy the application up to their servers, I get an "Internal Server Error".

但是,当我将应用程序部署到他们的服务器时,我收到“内部服务器错误”。

Here's the Error Summary:

这是错误摘要:

HTTP Error 500.19 - Internal Server Error

HTTP错误500.19 - 内部服务器错误

The requested page cannot be accessed because the related configuration data for the page is invalid.

无法访问请求的页面,因为页面的相关配置数据无效。

Here are the relevant portions of the Detailed Error Information:

以下是详细错误信息的相关部分:

Module: IIS Web Core

模块:IIS Web Core

Notification: BeginRequest

Handler: Not yet determined

处理程序:尚未确定

Error Code: 0x80070021

错误代码: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".

配置错误:此配置部分不能在此路径中使用。当该部分被锁定在父级别时会发生这种情况。锁定是默认情况下(overrideModeDefault =“Deny”),或由locationMode =“Deny”或遗留allowOverride =“false”的位置标记显式设置。

And the Config Source looks like this:

Config Source看起来像这样:

144:        </modules>
145:        <handlers>
146:            <remove name="WebServiceHandlerFactory-Integrated"/>

The error is coming from the fact that I have a system.webServer section in my web.config file that has a handlers child section. The system.webServer section is the exact config section that was laid down by default when I first created the ASP.NET MVC website in Visual Studio. It has the following XML comment above it:

该错误来自于我的web.config文件中有一个system.webServer部分,该部分有一个处理程序子部分。 system.webServer部分是我在Visual Studio中首次创建ASP.NET MVC网站时默认设置的确切配置部分。它上面有以下XML注释:

<!-- 
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0.  It is not necessary for previous version of IIS.
-->

I take the handlers child section out, and the 500 error goes away. Of course, that section is required for an ASP.NET MVC application to work properly in IIS7, so simply taking it only produces other errors (404 errors in this case since routing doesn't work).

我把处理程序子部分拿出来,500错误就消失了。当然,该部分是ASP.NET MVC应用程序在IIS7中正常工作所必需的,因此简单地使用它只会产生其他错误(在这种情况下会出现404错误,因为路由不起作用)。

The support engineers at ASPnix claim that ASP.NET MVC is installed and configured properly in IIS7 on their servers. I'm not saying I don't believe them as this is the first ASP.NET MVC site that I've built and deployed. However, I can't think of anything I could do to make this work since it appears to be a config issue at a level that I don't have access to.

ASPnix的支持工程师声称ASP.NET MVC在其服务器上的IIS7中正确安装和配置。我不是说我不相信它们,因为这是我构建和部署的第一个ASP.NET MVC站点。但是,我无法想到我能做的任何事情,因为它似乎是一个我无法访问的级别的配置问题。

This issue smells like it would be a common issue with folks trying to deploy ASP.NET MVC to a hosting provider. Has anything run into this either with ASPnix or other web hosting companies and hopefully found a solution?

这个问题有点像尝试将ASP.NET MVC部署到托管服务提供商的人们的常见问题。有没有与ASPnix或其他网络托管公司有关的事情,并希望找到一个解决方案?

ps

One odd thing. When researching this issue on the web I find many people saying they had to set the overrideModeDefault attribute their applicationHost.config files of IIS7 to from "Deny" to "Allow". However, my local development server has this set to "Deny" and everything works fine. Even so, I don't have access to the applicationHost.config file anyway on the web host's server.

奇怪的是。在网上研究这个问题时,我发现很多人都说他们必须将其对IIS7的applicationHost.config文件的overrideModeDefault属性设置为“拒绝”为“允许”。但是,我的本地开发服务器将此设置为“拒绝”,一切正常。即便如此,我仍然无法访问web主机服务器上的applicationHost.config文件。

3 个解决方案

#1


7  

Open IIS Management, Under the main server node, select open Feature Delegation (in Management section)

打开IIS管理,在主服务器节点下,选择打开功能委派(在管理部分)

"Handler Mappings" to "Read/Write" instead of "Read Only"

“处理程序映射”到“读/写”而不是“只读”

It looks like your hosting provider unnecessarily locked down IIS.

看起来您的托管服务提供商不必要地锁定了IIS。

I was able to recreate the problem on my local IIS 7.5 server.

我能够在我的本地IIS 7.5服务器上重新创建该问题。

See this for a global settings reset.

有关全局设置重置的信息,请参阅此

#2


0  

please check if you deployed your application properly : Deploying an ASP.NET Server (IIS 7)

请检查您是否正确部署了应用程序:部署ASP.NET服务器(IIS 7)

#3


0  

The link to http://www.winservermart.com/Howto/HTTP_Error_500_19_IIS_7.aspx doesn't fix the problem. The "reset delegation" creates an exception in web.config for a particular domain only which makes the site work, but doesn't answer how to set it permanently system wide. So, it's not shame, because we know the solution and set all settings correctly. And advertising here some other hosts pointless we have tons of clients that are running from wh4l and describing how great their overloaded servers.

指向http://www.winservermart.com/Howto/HTTP_Error_500_19_IIS_7.aspx的链接无法解决问题。 “重置委派”仅在特定域的web.config中创建一个异常,这使得站点可以工作,但是没有回答如何在系统范围内永久设置它。所以,这并不羞耻,因为我们知道解决方案并正确设置所有设置。在这里广告其他一些主机毫无意义我们有大量的客户端从wh4l运行并描述了他们的服务器过载有多么棒。

-Polk

#1


7  

Open IIS Management, Under the main server node, select open Feature Delegation (in Management section)

打开IIS管理,在主服务器节点下,选择打开功能委派(在管理部分)

"Handler Mappings" to "Read/Write" instead of "Read Only"

“处理程序映射”到“读/写”而不是“只读”

It looks like your hosting provider unnecessarily locked down IIS.

看起来您的托管服务提供商不必要地锁定了IIS。

I was able to recreate the problem on my local IIS 7.5 server.

我能够在我的本地IIS 7.5服务器上重新创建该问题。

See this for a global settings reset.

有关全局设置重置的信息,请参阅此

#2


0  

please check if you deployed your application properly : Deploying an ASP.NET Server (IIS 7)

请检查您是否正确部署了应用程序:部署ASP.NET服务器(IIS 7)

#3


0  

The link to http://www.winservermart.com/Howto/HTTP_Error_500_19_IIS_7.aspx doesn't fix the problem. The "reset delegation" creates an exception in web.config for a particular domain only which makes the site work, but doesn't answer how to set it permanently system wide. So, it's not shame, because we know the solution and set all settings correctly. And advertising here some other hosts pointless we have tons of clients that are running from wh4l and describing how great their overloaded servers.

指向http://www.winservermart.com/Howto/HTTP_Error_500_19_IIS_7.aspx的链接无法解决问题。 “重置委派”仅在特定域的web.config中创建一个异常,这使得站点可以工作,但是没有回答如何在系统范围内永久设置它。所以,这并不羞耻,因为我们知道解决方案并正确设置所有设置。在这里广告其他一些主机毫无意义我们有大量的客户端从wh4l运行并描述了他们的服务器过载有多么棒。

-Polk