多分誰かが私を助けることができます。
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
そこで、サーバーで Failed Request Tracing を試してみたところ、次のようになりました (必要に応じて完全なトレースを提供できます)。
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)
4日間、頭を壁にぶつけています。助けていただければ幸いです:)
PS: Windows Server 2008 R2 と IIS 7.5 を使用しています。
編集1:
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 アクションを検証することを考えさせられます。
http://tempuri.org/MVSWebServices_I/getTimestamp
そして、私のクライアント (Android アプリケーション) で:
http://tempuri.org/MVSWebService_I/getTimestamp
私の行動に欠けているsを見つけるためだけに!! 不足している文字を SOAP アクションに追加したところ、すべてうまくいきました。それだけです、この行方不明の手紙は私に4日かかりましたが、私はまだプログラミングが大好きです:D
ご協力ありがとうございました。