也许有人可以帮助我。
我在IIS上托管WCF服务。可以从浏览器访问.svc文件。它在本地工作但当我在服务器上发布并且我想从我的客户端调用方法时,我总是从服务器获得HTTP状态500.
这是我的web.config文件
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<!-- Allow receiving of large files, maxRequestLength is in kB -->
<httpRuntime maxRequestLength="2097151" executionTimeout="300" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="WebServices.MVSWebServicesBehavior"
name="WebServices.MVSWebServices">
<endpoint address="" binding="basicHttpBinding" contract="WebServices.MVSWebServices_I" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://<ipaddr>/WebServices/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WebServices.MVSWebServicesBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
日志文件只显示
2013-06-17 13:55:44 <ipaddr> POST /WebServices/MVSWebServices.svc - 80 - <ipaddr> ksoap2-android/2.6.0+ 500 0 0 2121
所以我尝试了服务器上的失败请求跟踪,我得到了(如果需要,我可以提供完整的跟踪):
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName IsapiModule
Notification 128
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation completed successfully. (0x0)
四天我撞到墙壁,任何帮助都会受到赞赏:)
PS:我正在使用Windows Server 2008 R2和IIS 7.5
EDIT1:
启用WCF跟踪后,会出现以下错误消息:
The message with Action 'http://tempuri.org/MVSWebService_I/getTimestamp' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
合同不匹配让我想到验证WSDL文件中的SOAP Action:
http://tempuri.org/MVSWebServices_I/getTimestamp
然后在我的客户端(Android应用程序):
http://tempuri.org/MVSWebService_I/getTimestamp
在我的行动中发现缺少 s !我将缺少的字母添加到SOAP操作中,一切运行良好。 这就是它,这封丢失的信件花了我4天但我还是喜欢编程:D
感谢您的帮助。
答案 0 :(得分:0)
如果你在服务器上运行浏览器而不是在本地运行它试图命中服务器,你可以点击它吗?