未处理 System.Exception
Message="出错啦!"
Source="ConsoleApplication7"
StackTrace:
在 ConsoleApplication7.Program.Main(String[] args) 位置 C:\Users\chen\Documents\Visual Studio 2008\Projects\ConsoleApplication7\ConsoleApplication7\Program.cs:行号 120
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ServiceModel.ProtocolException
Message="响应消息的内容类型 multipart/related; type=\"application/xop+xml\"; start=\"<soap.xml@xfire.codehaus.org>\"; start-info=\"text/xml\"; boundary=\"----=_Part_32_33259522.1385518574113\" 与绑定(text/xml; charset=utf-8)的内容类型不匹配。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 1022 个字节为:“\r\n------=_Part_32_33259522.1385518574113\r\nContent-Type: application/xop+xml; charset=UTF-8; type=\"text/xml\"\r\nContent-Transfer-Encoding: 8bit\r\nContent-ID: <soap.xml@xfire.codehaus.org>\r\n\r\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soap:Header>\n<wsse:Security soap:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><ds:Signature Id=\"Signature-5184696\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n<ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:Reference URI=\"#Timestamp-5896909\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n<ds:Transforms xmlns:ds=\"http://w”。"
Source="mscorlib"
StackTrace:
Server stack trace:
在 System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
在 System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 ConsoleApplication7.ServiceReference2.SolEdiFileUploadWebServicePortType.doEdiFileUpload(Attafile[] in0)
在 ConsoleApplication7.ServiceReference2.SolEdiFileUploadWebServicePortTypeClient.doEdiFileUpload(Attafile[] in0) 位置 C:\Users\chen\Documents\Visual Studio 2008\Projects\ConsoleApplication7\ConsoleApplication7\Service References\ServiceReference2\Reference.cs:行号 491
在 ConsoleApplication7.Program.Main(String[] args) 位置 C:\Users\chen\Documents\Visual Studio 2008\Projects\ConsoleApplication7\ConsoleApplication7\Program.cs:行号 102
InnerException:
解决方案:
app.config配置文件中 一开始使用的是textMessageEncoding 改为 mtomMessageEncoding
<customBinding>
<binding name="Custom11">
<textMessageEncoding messageVersion="Soap11" />
<security defaultAlgorithmSuite="Basic128" allowSerializedSigningTokenOnReply="true"
authenticationMode="MutualCertificate" requireDerivedKeys="false"
securityHeaderLayout="Lax" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<secureConversationBootstrap />
</security>
<httpsTransport maxReceivedMessageSize="65536000" authenticationScheme="Ntlm"
proxyAuthenticationScheme="Basic" />
</binding>
</customBinding>
问题解决~!