在win2003上 winform的窗口程序调用webservices失败,报错如下:
System.InvalidOperationException: The operation 'HelloWorldAsync' 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.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)
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.ChannelFactory1.CreateChannel(EndpointAddress address, Uri via)
1.CreateChannel()
at System.ServiceModel.ChannelFactory
at System.ServiceModel.ClientBase1.CreateChannel()
1.CreateChannelInternal()
at System.ServiceModel.ClientBase
at System.ServiceModel.ClientBase1.get_Channel()
1[ZSL.DataExchangeForX3.WebService1Soap], cannot be used for communication because it is in the Faulted state.
at ZSL.DataExchangeForX3.WebService1SoapClient.ZSL.DataExchangeForX3.WebService1Soap.CloseBill(CloseBillRequest request)
at ZSL.DataExchangeForX3.WebService1SoapClient.CloseBill(String vcrnum, String data)
at ZSL.IMPModPOHLine.ToSaveData()
还有:
调用x3接口报错System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.ChannelFactory
at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposed()
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory1.CreateChannel(EndpointAddress address, Uri via)
1.CreateChannel()
at System.ServiceModel.ChannelFactory
at System.ServiceModel.ClientBase1.CreateChannel()
1.CreateChannelInternal()
at System.ServiceModel.ClientBase
at System.ServiceModel.ClientBase`1.get_Channel()
at ZSL.DataExchangeForX3.WebService1SoapClient.ZSL.DataExchangeForX3.WebService1Soap.CloseBill(CloseBillRequest request)
at ZSL.DataExchangeForX3.WebService1SoapClient.CloseBill(String vcrnum, String data)
at ZSL.IMPModPOHLine.ToSaveData()
程序是在win10开发测试运行,webservices发布在win2012。程序在本地跑没有问题,但是放在服务器上就会报错。
在win2003的服务器,用浏览器可以访问webservices
2003有点老,你在浏览器里打开你的web service地址,有内容么
看看是不是ssl证书缺少,或者网络的问题。