我创建了一个Web服务,我已经在IIS7在我的本地机器上托管,并没有工作在局域网内使用的任何问题和canbe。然后我主持它在支付微软Web服务器,但一旦我打开的.asmx或任何其它浏览器的网页它给了以下错误消息
500内部服务器错误。有一个与你正在寻找的资源问题,它无法显示。
我的web.config显示如下。
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<!--
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.
-->
</configuration>
OK,我们将要看看什么是错的或者是什么原因造成的错误。所以上手加入这行
<customErrors mode="Off"/>
下
<authentication mode="Windows"/>
在你的web.config文件。
然后尝试并加载你的页面,它应该产生一个详细的错误信息,究竟在何处发生了误差,即哪一行代码
检查你的URL(Web服务地址)在你的代码的AJAX部分。
5XX错误是内部错误,通常是与您的代码或在您的服务器缺少一些配置相关联,因为它是一个支付的主机,我想认为这是你的代码有问题,尝试启用详细的错误页面。添加到您的web.config
<system.web>
<customErrors mode="Off">
</system.web>
记住要更改此选项回你完成调试时