简体   繁体   English

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

[英]Wcf The server was unable to process the request due to an internal error

I have created some wcfs.我创建了一些 wcfs。 One of them when i have tried to run it produced the picture below当我尝试运行它时,其中之一产生了下面的图片

When i have created the config and cs files and tried to run it with the code mentioned in the picture above after i have edited the web.config file of the web form from where it would be called the following comes up:当我创建了 config 和 cs 文件并在我编辑了 web 表单的 web.config 文件后尝试使用上图中提到的代码运行它时,它会被称为以下内容:

At this point, i read in similar posts about microsoft service trace viewer and svclog files.在这一点上,我阅读了有关 Microsoft 服务跟踪查看器和 svclog 文件的类似帖子。 But since i am pretty new at this no helpful info could come out from the files.但由于我对此很陌生,因此无法从文件中获得有用的信息。 Any help would be really appreciated任何帮助将非常感激

I think that posting here all the text would be a bit too big, though i can upload the photo in a cloud.我认为在这里发布所有文字会有点太大,但我可以将照片上传到云中。 I have changed a bit the name of the web service as its functions the error though remains the same.我已经稍微更改了 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>

The above is the output.config and the one below is the web.config after i added data from the above:上面是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>

Lastly the updated image of the error can be found here: link最后,可以在此处找到错误的更新图像: 链接

I had the same error in a service I created.我在创建的服务中遇到了同样的错误。 What I did was change this line in the web.config file: serviceDebug includeExceptionDetailInFaults="false" to "true" It gives a lot better detail explanation, in my case it was a typo in my connection string我所做的是在 web.config 文件中更改这一行: serviceDebug includeExceptionDetailInFaults="false" 到 "true" 它提供了更好的详细解释,在我的情况下,它是我的连接字符串中的一个错字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM