我的ASMX服务有问题。如果我使用POST方法,则返回错误“500 - 内部服务器错误”。但是如果我使用GET方法,它的工作原理非常好。我查看了IIS日志并看到了这种情况:
2013-01-16 00:00:06 212.158.165.217 GET /service.asmx/GetStopSalesAndQuotes2 Login=xxxxx&Password=xxxxx=&checkPoint=2013-01-08T14:22:56Z 80 -
85.12.229.170 Mozilla/4.0+(compatible;+Windows+NT+5.1;+SV1);+ross-tur.ru;+8-800-100-99-30+(ext.+501); 500 0 0 140
2013-01-16 00:00:06 212.158.165.217 POST /service.asmx - 80 -
62.80.175.194 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.296) 500 0 0 31
我已经找到了这个问题并试图解决它。
首先,我检查了一个web.config,但已经建立了必要的标签:
<add name="HttpGet"/>
<add name="HttpPost"/>
Secondary我试图通过在web.config中添加一些标签来打开调试模式:
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.Web.Services.Asmx">
<listeners>
<add name="AsmxTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="local.log" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId" />
</listeners>
</source>
</sources>
<switches>
<add name="System.Web.Services.Asmx" value="Verbose" />
</switches>
</system.diagnostics>
但是还没有创建日志。我想,申请没有权利。
我尝试通过为我的网站指定管理员的登录/通行证来授予管理员权限,但它尚未解决问题并且仍未创建日志。
我尝试调试此错误的其他方法:
<system.web> <customErrors mode="Off"/> <trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="false"/> </system.web>
<microsoft.web.services2> <diagnostics> <trace enabled="true"/> <policyTrace enabled="true"/> </diagnostics> <security> <timeToleranceInSeconds>86400</timeToleranceInSeconds> <securityTokenManager type="Megatec.MasterService.TourMLLogic.PasswordProvider, ServiceComponents, Version=1.0.0.0, Culture=neutral" qname="wsse:UsernameToken" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/> </security> </microsoft.web.services2>
但我没有任何结果。我认为,存在IIS配置问题。求你帮帮我。
P.S。请原谅我糟糕的英语=)
答案 0 :(得分:0)
我认为你正在使用不同的网址。
GET /service.asmx/GetStopSalesAndQuotes2
POST /service.asmx
请参阅下面的示例:
web服务:
public class Test : System.Web.Services.WebService {
public Test () {}
[WebMethod]
public string HelloWorld(string name) { return "Hello " + name; }
}
html测试:两者都有效
<form action="Test.asmx/HelloWorld" method="get">
<input type="text" name="name"/>
<input type="submit" value="Submit"/>
</form>
<form action="Test.asmx/HelloWorld" method="post">
<input type="text" name="name"/>
<input type="submit" value="Submit"/>
</form>