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

时间:2015-03-11 14:05:49

标签: 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 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."}

我认为绑定存在一些问题。我用谷歌搜索但没有找到任何解决方案。请指导我如何解决此问题。帮助将是欣赏。

由于

代码段:

服务网站.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>

的Index.aspx

  private void process() 
    {
        TestRef.EmployeeDC o = new TestRef.EmployeeDC();
        o.userID = signInEmail;
        o.companyID = signInPassword;

        //ServiceReference.EmployeeDC p = new ServiceReference.EmployeeDC();


        //Service Call
        TestRef.TestServClient tsc = new TestRef.TestServClient();
        tsc.callBusinessLayer(o); // here im getting the exception

        Debug.Print(""+signInEmail);
    }

客户端Web.Config

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

0 个答案:

没有答案
相关问题