WCF服务在本地主机上运行(调试),但部署失败

时间:2019-05-24 00:36:18

标签: wcf wsdl wcf-data-services

我有一个WCF服务,当我在本地主机上运行该服务时,可以使用WCF测试客户端来调用它并获得结果。当我将其实际托管在实时服务器上时,我也可以看到它,因为它在测试客户端上生成方法,并且在Chrome中打开时可以看到wsdl页面。

但是(因为它总是有一个but),当我用WCF Test Client调用它时,出现此错误:

Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

Server stack trace: 
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)   
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)  at IRp3Services.CreateTransaction(NewTransaction model)   at Rp3ServicesClient.CreateTransaction(NewTransaction model)

我似乎无法理解为什么,我已经在本地对其进行了测试并且可以正常工作,这是Web配置:

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.5.2" />
        <httpRuntime targetFramework="4.5.2"/>
    </system.web>


<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ConsultasSoap" />
        <binding name="TransaccionesSoap" />
        <binding name="SeguridadSoap" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://address/Rp3.Web.Credishop.Afiliados/consultas.asmx"
        binding="basicHttpBinding" bindingConfiguration="ConsultasSoap"
        contract="RP3Consultas.ConsultasSoap" name="ConsultasSoap" />
      <endpoint address="http://address/Rp3.Web.Credishop.Afiliados/transacciones.asmx"
        binding="basicHttpBinding" bindingConfiguration="TransaccionesSoap"
        contract="RP3Transacciones.TransaccionesSoap" name="TransaccionesSoap" />
      <endpoint address="http://address/Rp3.Web.Credishop.Afiliados/seguridad.asmx"
        binding="basicHttpBinding" bindingConfiguration="SeguridadSoap"
        contract="RP3Seguridad.SeguridadSoap" name="SeguridadSoap" />
    </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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpBinding" scheme="http" />
    </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>

我真的很茫然,我很乐意在这里做错任何事情。

0 个答案:

没有答案