ASP.NET Core 2.0 WCF 配置绑定。

4
我使用连接的WCF服务的ASP.NET Core 2.0 Web API。 在普通的ASP.NET中,我可以在web.config中配置basicHttpBinding。但是我找不到任何解决方案来配置ASP.NET Core中的basicHttpBinding。
我必须设置transferMode="Streamed"和maxReceivedMessageSize="128108864"。
编辑:这是一个带有完整.NET目标框架的ASP.NET Core 2.0 Web API。
1个回答

4

我刚遇到了类似的问题。看起来web.config已经不再可用,因为它仅在IIS中使用,而由于Asp.net core 2不需要IIS,因此web.config是无关紧要的。尽管我尝试添加它,但它仍然无法正常工作。

最好的方法是以编程方式解决这个问题。

BasicHttpBinding vidiBinding = new BasicHttpBinding();
vidiBinding.MaxReceivedMessageSize = 2000000;

EndpointAddress myEndPPtAdd = new EndpointAddress("http://localhost:9200/SilverlightVidiCloudService");

VidiExternalCloudServiceClient myClient = new VidiExternalCloudServiceClient(vidiBinding, myEndPPtAdd);
await myClient.OpenAsync();

遇到相同的问题。 - Danish

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接