WSDL和BasicHttpBinding的F#类型提供程序 [英] F# Type Provider for WSDL and BasicHttpBinding
问题描述
当我在C#中使用WSDL服务时,我能够将两个参数传递给构造函数; BasicHttpBinding和EndpointAddress
When I use a WSDL service in C# I am able to pass two parameters to the constructor; BasicHttpBinding and EndpointAddress
BasicHttpBinding basicHttpBinding = new BasicHttpBinding { MaxReceivedMessageSize = 20000000, MaxBufferSize = 20000000 };
EndpointAddress endpointAddress = new EndpointAddress(delarsListUrl);
var ds = new DealersService.DealersServiceClient(basicHttpBinding,endpointAddress);
当我在F#中使用WSDL类型提供程序时,只允许不带任何参数或具有一个类型为BasicHttpBinding的参数来调用构造函数.那么,如何设置MaxReceivedMessageSize或MaxBufferSize之类的参数?
When I use the WSDL Type provider in F# I am only allowed to call the constructor without any parameters or with one parameter of type BasicHttpBinding. So how do I set the parameters like MaxReceivedMessageSize or MaxBufferSize?
如果我将其放在Azure Worker角色的app.config中
If I put this to the app.config of the Azure Worker role
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
这无济于事,我仍然得到一个例外,那就是maxReceivedMessageSize只有64k,我应该更改它.我在C#中遇到了同样的问题,app.config设置似乎被忽略了,所以我通过将带有这些设置的BasicHttpBinding传递给构造函数来解决了这个问题.
It does not help, I still get an exception that maxReceivedMessageSize is only 64k and I should change it. I had the same problem in C#, the app.config setting seemed to be ignored so I solved it by passing an BasicHttpBinding with these settings to the constructor.
推荐答案
简化的数据上下文(通过T.GetDataContext()创建)仅公开无参数构造函数和接受EndpointAddress的构造函数.如果要手动设置绑定-您可以直接实例化客户端类(它应该位于ServiceTypes中),即:
simplified data context (that is created via T.GetDataContext()) exposes only parameterless constructor and constructor that accepts EndpointAddress. If you want to setup bindings manually - you can instantiate client class directly (it should be located inside ServiceTypes) i.e.:
type WSDL = Microsoft.FSharp.Data.TypeProviders.WsdlService< @"http://www.webservicex.net/RealTimeMarketData.asmx?WSDL">
let client = new WSDL.ServiceTypes.RealTimeMarketDataSoapClient(...)
这篇关于WSDL和BasicHttpBinding的F#类型提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!