2011-09-13 12 views
2

wcfを初めて使用しています。 iis 7.5のチュートリアルを使用してシンプルなwcfサービスを作成してホストしました。http://debugmode.net/2010/09/07/walkthrough-on-creating-wcf-4-0-service-and-hosting-in-iis-7-5/IIS7.5でのWCFサービスのホスティング

このサービスを利用しようとするまでは、すべてうまく行きます。私は私のクライアントにサービス参照を追加しようとすると、それは次のエラーを与える私のサービスの

Metadata contains a reference that cannot be resolved: 'http://localhost:4567/Service1.svc?wsdl'. The WSDL document contains links that could not be resolved. There was an error downloading 'http://localhost:4567/Service1.svc?xsd=xsd0'. The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host Metadata contains a reference that cannot be resolved: 'http://localhost:4567/Service1.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:4567/Service1.svc . The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'. If the service is defined in the current solution, try building the solution and adding the service reference again.

web.configファイルが

<?xml version="1.0"?> 
<configuration> 

<system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
</system.web> 
<system.serviceModel> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior> 

     <serviceMetadata httpGetEnabled="true"/> 

     <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
    </serviceBehaviors> 
</behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
</system.serviceModel> 
<system.webServer> 
<modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer> 

+0

クライアント側のwcf設定は何ですか? –

+0

クライアント側にwcf設定がありません。クライアントでは、私はjuxのサービス参照を追加しようとしています – yrahman

答えて

4

が含まれていますこれは通常、例外であることによって生じた一般的なエラーですサービスによって投げられた。残念ながら、includeExceptionDetailInFaultsはあなたの設定ではfalseに設定されているので、サービスを消費しているクライアントでは、SOAP例外の詳細は表示されません。

最初に、開発環境にincludeExceptionDetailInFaults = "true"を設定して、追加の例外の詳細が表示されるようにしてください。次に、ブラウザを使用して直接http://localhost:4567/Service1.svcにナビゲートし、汎用サービスページが表示されているかどうかを確認してください。次に、http://localhost:4567/Service1.svc?wsdlにナビゲートして、WSDLが適切に表示されているかどうかを確認してください。両方の状況で、サービスによってスローされたエラーがブラウザにスローされます。うまくいけば、これはあなたの問題の根本的な原因につながります。まだ問題を把握できない場合は、追加情報を投稿してください。がんばろう!

+0

私はurの両方のブラウザでブラウザにアクセスしようとしましたが、ブラウザで正常に動作します。私はweb.configでtrueにincludeExceptionDetailInFaultsを変更しました。再発行されたサービスを参照してクライアントに参照を追加しようとしますが、追加の詳細なしでまったく同じエラーが発生します。 – yrahman

+1

次のステップでは、エラーをスローするxsdにアクセスしようとしています。ブラウザーでhttp:// localhost:4567/Service1.svc?xsd = xsd0に移動して、エラーがスローされたかどうかを確認してください。 – Capps

関連する問題