web-dev-qa-db-ja.com

内部エラーのため、サーバーはリクエストを処理できませんでした。 WCFエラーで

C#を使用してフレームワーク4.0でサービスを作成しました。値を返す簡単なメソッドです

Web.configは次のようなものです。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <machineKey validationKey="0E1F430D6FFFA91FBEDAEC1D2DDAAC2127EB055DBAFB78328C5BDE83249A94EA66400453B" decryptionKey="A13EACEAAABBECF2D06619924A8" validation="SHA1" decryption="AES" />
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="DecryptCookie.Service1">
        <Host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8732/Design_Time_Addresses/WCFandEFService/ProductService/" />
          </baseAddresses>
        </Host>
        <endpoint address=""  binding="wsHttpBinding"    contract="DecryptCookie.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract = "IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>  
</configuration>

サービスを利用しようとすると、次のようなエラーが発生します。

Error: The server was unable to process the request due to an internal error. 
For more information about the error, either turn on
IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from
the configuration behavior) on the server in   order to send the exception
information back to the client, or turn on tracing as per the Microsoft .NET
Framework 3.0 SDK documentation and inspect the server trace
logs.System.Exception {System.ServiceModel.FaultException}

何が問題なのかわかりません。

4
happysmile

これらの不可解なエラーが発生したら、トレースをオンにしてサービスログ(.svcLog)を作成します。その後、Service TraceViewerツールを使用してこのファイルをロード/読み取りできます。これにより、エラーに関する詳細なデータが得られます。このリンクの指示に従ってください- http://msdn.Microsoft.com/en-us/library/ms732023.aspx

12
Big Daddy

プロキシファイルを確認してください。ビジネス/データアクセスファイルの内容を更新し、プロキシを更新していないかどうかを確認します。これはプロキシエラーが原因です。

1
user2531498

web.configファイルに診断を追加してログを取得してみてください。

 <system.diagnostics> 
      <sources> 
        <source name="System.ServiceModel" 
                switchValue="All" 
                propagateActivity="true"> 
          <listeners> 
            <add name="traceListener" 
                type="System.Diagnostics.XmlWriterTraceListener" 
                initializeData= "D:\AppLogs\Traces.svclog" /> 
          </listeners> 
        </source> 
      </sources> 
    </system.diagnostics>
0
elfekz

あるシステムから別のシステムにプロジェクトをコピーする場合があります。この場合、web.configからエンドポイントを削除し、サービス参照を再度追加する必要があります。

より多くのエラー情報を取得するには、トレースを構成してみてください。

WCFサービスライブラリのapp.configファイルを開き、system.diagnosticsの構成を追加します

  <sources>
      <source name="System.ServiceModel" 
            switchValue="Critical,Information,ActivityTracing"
                propagateActivity="true">
        <listeners>
                 <add name="messages"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="c:\logs\messages.svclog" />
          </listeners>
      </source>
    </sources>
    <trace autoflush="true" />
  </system.diagnostics> ```
0
Vinay Arora