У меня есть служба WCF, которая работает, когда я запускаю ее на локальном хосте, с помощью тестового клиента WCF я могу вызвать ее и получить результат. Я также вижу это, когда фактически размещаю его на живом сервере, поскольку он генерирует методы на тестовом клиенте, и я вижу страницу wsdl при открытии в Chrome.
Но (поскольку у него всегда есть «но»), когда я вызываю его с помощью 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)
Кажется, я не понимаю, почему, я проверил это локально и отлично работает, вот веб-конфиг:
<?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>
Я действительно в растерянности, мне бы очень хотелось узнать, что я здесь делаю неправильно.