Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法调用WCF服务中声明的方法_C#_Asp.net_Wcf_Wcf Binding - Fatal编程技术网

C# 无法调用WCF服务中声明的方法

C# 无法调用WCF服务中声明的方法,c#,asp.net,wcf,wcf-binding,C#,Asp.net,Wcf,Wcf Binding,我已经创建了WCF服务,并将该服务使用到客户端应用程序中,但无法调用该方法 发生以下异常: {"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

我已经创建了WCF服务,并将该服务使用到客户端应用程序中,但无法调用该方法

发生以下异常:

{"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 <serviceDebug> 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 SDK documentation and inspect the server trace logs."}
客户端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>
    <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>
    <configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ITestServ" />
        <binding name="BasicHttpBinding_ITestServ1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/Publish/TestServ.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_ITestServ" contract="ServiceReference.ITestServ"
        name="BasicHttpBinding_ITestServ" />
      <endpoint address="http://localhost/Publish/TestServ.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_ITestServ1" contract="TestRef.ITestServ"
        name="BasicHttpBinding_ITestServ1" />
    </client>
  </system.serviceModel>
</configuration>

遵循错误消息建议如何?在服务器上启用IncludeExceptionDetailInFaults(从ServiceBehaviorAttribute或从配置行为),以便将异常信息发送回客户端,或者根据Microsoft.NET Framework SDK文档启用跟踪,并检查服务器跟踪日志检查ABC(地址、绑定和契约)用于服务和客户端匹配。在服务器和客户端上调试/启用跟踪。
    <configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ITestServ" />
        <binding name="BasicHttpBinding_ITestServ1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/Publish/TestServ.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_ITestServ" contract="ServiceReference.ITestServ"
        name="BasicHttpBinding_ITestServ" />
      <endpoint address="http://localhost/Publish/TestServ.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_ITestServ1" contract="TestRef.ITestServ"
        name="BasicHttpBinding_ITestServ1" />
    </client>
  </system.serviceModel>
</configuration>