您的位置:首页 > Web前端

Service References to a MTOM web services

2015-09-18 15:03 211 查看
In VS2013, we tried to add a web service wsdl and the reference.cs is always empty. As per the web service provider, we tried to below command by svcutil.exe to generate the reference.cs and .config file
· svcutil [wsdl url] /out:references.cs /serializer:XmlSerializer

https://msdn.microsoft.com/en-us/library/aa347733%28v=vs.110%29.aspx

with below configuration for binding generated by the tool, the web service will returns an exception saying something like not expected content type
<basicHttpBinding>
<binding name="SlsServiceWSSoapBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>

We added below messageEncoding="Mtom" and MaxReceivedMessageSize to the bindings, then it works
<basicHttpBinding>
<binding name="SlsServiceWSSoapBinding" messageEncoding="Mtom" maxReceivedMessageSize="2000000000">
<security mode="Transport" />
</binding>
</basicHttpBinding>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: