客户端上的Soap Web Service异步方法调用异常

时间:2016-02-10 12:20:31

标签: c# web-services soap

我们有一个名为GetAuthorizationKey的asmx soap web服务方法,并且有一个使用此Web服务方法的Windows服务但是当我安装构建我的本地计算机配置为针对远程服务运行时,它运行并且抛出没有异常但是当我安装时对Windows 2008服务器的构建,该服务抛出异常。

Exception: the operation 'GetAuthorizationKeyAsync' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.    at System.ServiceModel.Dispatcher.OperationFormatter.Validate(OperationDescription operation, Boolean isRpc, Boolean isEncoded)
   at System.ServiceModel.Dispatcher.OperationFormatter..ctor(OperationDescription description, Boolean isRpc, Boolean isEncoded)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter..ctor(OperationDescription description, DataContractFormatAttribute dataContractFormatAttribute, DataContractSerializerOperationBehavior serializerFactory)
   at System.ServiceModel.Description.DataContractSerializerOperationBehavior.GetFormatter(OperationDescription operation, Boolean& formatRequest, Boolean& formatReply, Boolean isProxy)
   at System.ServiceModel.Description.DataContractSerializerOperationBehavior.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
   at System.ServiceModel.Description.DispatcherBuilder.BindOperations(ContractDescription contract, ClientRuntime proxy, DispatchRuntime dispatch)
   at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
   at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
   at System.ServiceModel.ChannelFactory.CreateFactory()
   at System.ServiceModel.ChannelFactory.OnOpening()
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ChannelFactory.EnsureOpened()
   at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.ClientBase`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at service.AuthService.AuthServiceSoapClient.service.AuthService.AuthServiceSoap.GetAuthorizationKey(GetAuthorizationKeyRequest request)
   at service.AuthService.AuthServiceSoapClient.GetAuthorizationKey(String UserName, String Password)
   at service.Helpers.AuthHelper.GetAuthKey()
   at service.ArchiveService.OnStart(String[] args) 

Service binding configuration as follows on client side:
<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="basicHttp" sendTimeout="00:03:00" allowCookies="true"
                    maxBufferPoolSize="20000000" maxBufferSize="20000000" maxReceivedMessageSize="20000000">
                    <readerQuotas maxDepth="32" maxStringContentLength="200000000"
                        maxArrayLength="200000000" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://10.179.160.157/VpefWebservice/EArchive/EArchiveOperations.asmx"
                binding="basicHttpBinding" bindingConfiguration="basicHttp"
                contract="EArchiveOperations.EArchiveOperationsSoap" name="EArchiveOperationsSoap" />
            <endpoint address="http://10.179.160.157/VpefWebservice/AuthService.asmx"
                binding="basicHttpBinding" bindingConfiguration="basicHttp"
                contract="AuthService.AuthServiceSoap" name="AuthServiceSoap" />
            <endpoint address="http://10.179.160.157/VpefWebservice/EInvoice/EInvoiceStagingService.asmx"
                binding="basicHttpBinding" bindingConfiguration="basicHttp"
                contract="EStagingService.EInvoiceStagingServiceSoap" name="EInvoiceStagingServiceSoap" />
            <endpoint address="http://10.179.160.157/VpefWebservice/ELedger/ELedgerOperations.asmx"
                binding="basicHttpBinding" bindingConfiguration="basicHttp"
                contract="ELedgerOperations.ELedgerOperationsSoap" name="ELedgerOperationsSoap" />
            <endpoint address="http://10.179.160.157/VpefWebservice/EArchive/EArchiveReportOperations.asmx"
                binding="basicHttpBinding" bindingConfiguration="basicHttp"
                contract="EArchiveReportOperations.EArchiveReportOperationsSoap"
                name="EArchiveReportOperationsSoap" />
        </client>
    </system.serviceModel>

1 个答案:

答案 0 :(得分:0)

安装4.6框架后,它开始正常运行。