由于内部错误,服务器无法处理请求.在 WCF 错误中

问题描述:

我已经使用 C# 在框架 4.0 中编写了我的服务.这是一个返回值的简单方法

I have written my service in framework 4.0 using C#. It's an simple method which returns a value

Web.config 是这样的:

The Web.config is like this:

<?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>

当我尝试使用该服务时,出现如下错误:

When I try to consume the service, I am getting an error like this:

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}

我不确定是什么问题.

当我收到这些神秘错误时,我会打开跟踪并创建服务日志 (.svcLog).然后,您可以使用 Service Trace Viewer 工具加载/读取此文件.这将为您提供有关错误的详细数据.按照此链接上的说明操作 - http://msdn.microsoft.com/en-us/library/ms732023.aspx

When I get these cryptic errors, I turn on tracing and create a service log (.svcLog). You can then load/read this file using the Service Trace Viewer tool. This will give you detailed data regarding the error(s). Follow the instructions on this link - http://msdn.microsoft.com/en-us/library/ms732023.aspx