簡體   English   中英

wcf 由於內部錯誤,服務器無法處理請求

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

我創建了一些 wcfs。 當我嘗試運行它時,其中之一產生了下面的圖片

當我創建了 config 和 cs 文件並在我編輯了 web 表單的 web.config 文件后嘗試使用上圖中提到的代碼運行它時,它會被稱為以下內容:

在這一點上,我閱讀了有關 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>

最后,可以在此處找到錯誤的更新圖像: 鏈接

我在創建的服務中遇到了同樣的錯誤。 我所做的是在 web.config 文件中更改這一行: serviceDebug includeExceptionDetailInFaults="false" 到 "true" 它提供了更好的詳細解釋,在我的情況下,它是我的連接字符串中的一個錯字

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM