我正在尝试部署一个ASP。网络应用程序。我已经将网站部署到IIS,但当用浏览器访问它时,它显示给我这个:
服务器错误 500 -内部服务器错误。 您正在查找的资源有问题,无法显示。
在摆弄了网页之后。配置,我得到:
由于内部服务器错误,页面无法显示。
我如何才能看到这个服务器错误背后的实际问题?
我正在尝试部署一个ASP。网络应用程序。我已经将网站部署到IIS,但当用浏览器访问它时,它显示给我这个:
服务器错误 500 -内部服务器错误。 您正在查找的资源有问题,无法显示。
在摆弄了网页之后。配置,我得到:
由于内部服务器错误,页面无法显示。
我如何才能看到这个服务器错误背后的实际问题?
首先,您需要启用并查看web消息的详细错误,因为出于安全原因,这是一个一般性消息,没有提供关于实际发生情况的信息。
有了详细的错误,您可以在这里找到真正的问题。
此外,如果您可以在服务器上运行浏览器,则可以获得有关错误的详细信息,因为服务器识别出您是本地的,并将其显示给您。或者,如果您可以使用事件查看器读取服务器的日志,则还可以看到错误的详细信息。
第6页
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
第7页
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
注意:你可以避免Debug=true。您只需要暂时关闭自定义错误,并获得详细的错误页面。
这可以帮助:如何启用详细的错误消息(从IIS)。
我在这个问题上非常紧张。确保下面的条目在根网络中。配置文件为我修复了它:
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
请记住,如果已有XML元素,则必须将其添加到现有的XML元素中。不能只在文件末尾添加,因为任何元素都不能有多个副本。
就我而言,我把一个错误放在我的网。配置文件。应用程序键以某种方式放在<appSettings>标记下。但是我想知道为什么它没有显示配置错误。错误500对于调查这个问题来说太一般了。
我第一次尝试发布并运行一个只提供HTML的非常简单的网站,结果是“页面无法显示,因为发生了内部服务器错误”。
问题:我在Visual Studio中将网站设置为。net 3.5(右键单击网站项目->属性页-> Build),但在Azure中将网站配置为。net 4.0。哦!我在Azure中将其更改为3.5,并且它可以工作。
我终于解决了这个“500内部服务器”错误时,部署ASP。NET MVC 3.0应用程序在godaddy上。Ocm共享托管。
不知何故,在引用的DLL文件版本和web.config文件中提到的版本上存在差异。
我尝试了各种论坛上提到的所有选项。没有任何帮助,尽管每个人都提出了相同的解决方案,但不知为何它在我的场景中不起作用。终于在撞了头两天之后。 我决定删除所有DLL文件引用和删除web。然后让应用程序抛出错误,然后逐个添加DLL文件,将其复制到local=true。
在添加了所有DLL文件之后,我创建了一个新的ASP。NET MVC应用程序,并复制了web。新应用程序的配置到我的实际应用程序。 我的实际应用程序现在有了一个新的网页。然后我从web的本地副本中复制了connectionstring和其他引用。我保存的配置。
我只是编译了应用程序并将其发布到本地文件夹 并将发布的文件夹FTP到goDaddy。
它起作用了,我的问题终于解决了。
500内部错误 Windows主机错误 Godaddy托管问题
我一直面临着同样的问题,但现在我的问题已经解决了。总是在这个主机上使用,它是有效的。
我也会建议大家做任何你想要在你的网站上做的改变。配置文件。请逐个执行,并在活动域中进行相同的测试,以便您可以找到确切的问题或托管提供商不允许您使用的功能。
<?xml version="1.0"?>
<configuration>
<system.web>
<trust level="Medium"/>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
<sessionState mode="InProc" cookieless="false" timeout="90" />
<authentication mode="Forms">
<forms loginUrl="default.aspx"
defaultUrl="default.aspx"
protection="All"
cookieless="UseCookies"
slidingExpiration="false"
timeout="30"
name="aeon.corpusjuris.in" />
</authentication>
<customErrors
mode="Off"
defaultRedirect="errorpage.aspx">
<error statusCode="403" redirect="errorpage.aspx"/>
<error statusCode="404" redirect="errorpage.aspx"/>
</customErrors>
<!-- <httpModules>
<add name="HTTPCaching" type="HTTPCaching"/>
</httpModules>
-->
</system.web>
<runtime>
<performanceScenario value="HighDensityWebHosting" />
</runtime>
<system.webServer>
<!-- <modules runAllManagedModulesForAllRequests="true">
<add name="HTTPCaching" type="HTTPCaching"/>
</modules>
-->
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
</files>
</defaultDocument>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<staticContent>
<clientCache cacheControlCustom="public"
cacheControlMaxAge="60:00:00"
cacheControlMode="UseMaxAge" />
</staticContent>
</system.webServer>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="90000000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
对我来说,下面的代码在网上。Config是罪魁祸首。当我删除它时,网站运行正常。
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
除了其他建议之外,请确保将httpErrors节点的现有response属性从Replace更改为Auto,或者完全删除该属性。
<httpErrors existingResponse="Replace" />
^^^^^^^ not going to work with this here
500内部服务器错误可能由以下几个原因引起。第一个原因可能是网络。配置文件没有正确创建,这意味着您在web中错过了一些标签。配置文件。其次,这个错误可能是由于一些代码问题。要检查web应用程序的哪个组件导致此错误,您可以检查web中的应用程序设置。配置文件。解决和跟踪500个服务器内部错误的详细图如下:
服务器错误500 -内部服务器错误。 您正在查找的资源有问题,无法显示。Goddady。主机-网络-经济- Windows Plesk
在我的例子中,我替换了以下代码:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>
然后将框架3.5更改为框架4。它显示了我的详细错误。我删除代码在:
<httpModules></httpModules>
它解决了我的问题。
确保您的帐户使用IIS 7。有关详细信息,请参见自定义Windows主机托管帐户上的IIS设置。 请按照Windows IIS 7托管帐户上更改管道模式的说明进行操作。选择“集成管道模式”。 在“项目参考”部分中,将以下程序集的“本地复制”设置为“True”:
System.Web.Abstractions
System.Web.Helpers
System.Web.Routing
System.Web.Mvc
System.Web.WebPages
将以下程序集添加到项目中,然后将“本地复制”设置为“True”:
Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
Publish your application.
可能是你的网。配置文件错误或缺少一些标签。我使用正确的。net 4配置标记解决了这个问题。
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<authentication mode="None"/>
</system.web>
有时,原因可能是您的.dll程序集没有在服务器上正确注册。
例如,您可以在安装了Office的本地机器上成功运行c# Excel web应用程序,但在服务器部署时得到500错误,因为服务器上没有安装Office套件,因此您得到服务器错误。
我意识到你服务器上的文件和文件夹的权限也很重要。我从linux操作系统上传了我的文件,通常读写权限是有限的。因此,在上传时,权限仍然与本地机器相同。
我有同样的错误,我只是改变了我上传的文件夹的权限,错误就消失了。
希望它能帮助到别人。
Before changing the web.config file, I would check that the .NET Framework version that you are using is exactly (I mean it, 4.5 != 4.5.2) the same compared to your GoDaddy settings (ASP.Net settings in your Plesk panel). That should automatically change your web.config file to the correct framework. Also notice that for now (January '16), GoDaddy works with ASP.Net 3.5 and 4.5.2. To use 4.5.2 with Visual Studio it has to be 2012 or newer, and if not 2015, you must download and install the .NET Framework 4.5.2 Developer Package. If still not working, then yes, your next step should be enabling detailed error reporting so you can debug it.
对于那些有这种可能性的人(VPS托管而不是网络托管):
通过远程桌面连接到托管服务器。从远程桌面打开Web浏览器,您将看到错误的详细描述。
你不需要修改web。配置或暴露任何细节给任何人。
如果您正在使用自定义HttpHandler(即实现IHttpModule),请确保您正在检查对其Error方法的调用。
你可以让你的处理程序在本地调试期间抛出实际的httpexception(它有一个有用的Message属性),如下所示:
public void Error(object sender, EventArgs e)
{
if (!HttpContext.Current.Request.IsLocal)
return;
var ex = ((HttpApplication)sender).Server.GetLastError();
if (ex.GetType() == typeof(HttpException))
throw ex;
}
还要确保检查异常的InnerException。
如果您正在使用IIS 8.5,可能需要将ApplicationPool ID设置从ApplicationPoolId更改为NetworkService
右键单击有问题的应用程序池,单击“高级设置”,然后向下滚动到ID——它可能会被设置为ApplicationPoolIdentity。单击按钮(..)并从下拉列表中选择NetworkService。
此外,如果是. net 2.0应用程序,请确保在应用程序池中没有引用4.0框架。
对于iis10,除了更改customErrors=Off来显示错误内容外,还有一个额外的步骤要做。
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpErrors existingResponse="PassThrough" errorMode="Detailed"/>
</system.webServer>
Raul在这个链接中回答了这个问题:关闭IIS8自定义错误
尝试在Debug模式下编译(在Visual Studio中)。如果您处于发布模式,许多URL重写错误将不可用。
图为Visual Studio中的调试选择组合框