当消费WebService时,我得到了以下错误:
URL意外以/myMethodName结尾,请求格式无法识别
如何解决这个问题?
当消费WebService时,我得到了以下错误:
URL意外以/myMethodName结尾,请求格式无法识别
如何解决这个问题?
当前回答
以我为例,当我从本地PC的Windows 10移动到安装Windows 2012的专用服务器时,出现了这个错误。 解决方案是添加到网络。配置以下行
<webServices>
<protocols>
<add name="Documentation"/>
</protocols>
</webServices>
其他回答
极好的。
情况2 -同样的问题可以出现)在我的情况下,问题是由于以下一行:
<webServices>
<protocols>
<remove name="Documentation"/>
</protocols>
</webServices>
它在服务器上工作得很好,因为直接调用webservice函数——但是如果你在调试环境中直接从。net运行服务,并且想要手动测试运行该函数,则会失败。
在html中,你必须将调用包含在一个带有GET的表单中
<a href="/service/servicename.asmx/FunctionName/parameter=SomeValue">label</a>
您还可以使用POST,其操作是web服务的位置,并通过输入标记输入参数。
还有SOAP和代理类。
确保您禁用了自定义错误。这可以掩盖代码中的原始问题:
改变
<customErrors defaultRedirect="~/Error" mode="On">
to
<customErrors defaultRedirect="~/Error" mode="Off">
我使用下面的代码行来解决这个问题。在web中编写以下代码。配置文件
<configuration>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
以我为例,当我从本地PC的Windows 10移动到安装Windows 2012的专用服务器时,出现了这个错误。 解决方案是添加到网络。配置以下行
<webServices>
<protocols>
<add name="Documentation"/>
</protocols>
</webServices>