Wcf由于内部错误,服务器无法处理请求

时间:2015-04-21 08:08:03

标签: c# wcf visual-studio-2012

我创建了一些wcfs。当我试图运行它时,其中一个产生了

下面的图片

当我创建了配置文件和cs文件并尝试使用上图中提到的代码运行它之后,我编辑了Web表单的web.config文件,它将被调用以下内容:< / p>

此时,我在类似的帖子中读到有关microsoft服务跟踪查看器和svclog文件的信息。但由于我是新手,因此文件中没有任何有用的信息。任何帮助都会非常感激

我认为在这里张贴所有文字会有点太大,不过我可以在云端上传照片。我已经改变了一点Web服务的名称,因为它的功能错误虽然保持不变。

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_Icheck_product" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:51182/check_product.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Icheck_product"
                contract="Icheck_product" name="BasicHttpBinding_Icheck_product" />
        </client>
    </system.serviceModel>
</configuration>

以上是output.config,下面是我从上面添加数据后的web.config:

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

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IEncrypt_Data" />
        <binding name="BasicHttpBinding_IGetDbConnection" />
        <binding name="BasicHttpBinding_Icheck_product" />


      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:50776/Encrypt_Data.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IEncrypt_Data" contract="Encypt_Data_Reference.IEncrypt_Data"
        name="BasicHttpBinding_IEncrypt_Data" />
      <endpoint address="http://localhost:50776/GetDbConnection.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGetDbConnection"
        contract="Get_Db_Connection.IGetDbConnection" name="BasicHttpBinding_IGetDbConnection" />


      <endpoint address="http://localhost:51182/check_product.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Icheck_product"
    contract="Icheck_product" name="BasicHttpBinding_Icheck_product" />

    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

最后,可以在此处找到错误的更新图像:link

1 个答案:

答案 0 :(得分:0)

我在创建的服务中遇到了相同的错误,并且确实在web.config文件中更改了此行:

serviceDebug includeExceptionDetailInFaults="false" to "true" 

它提供了更好的详细解释,在我的情况下,这是我的连接字符串中的错字