Search code examples
wcf-bindingasp.net-core-webapiasp.net-core-2.0

asp.net core 2.0 wcf configure binding


I use a asp.net core 2.0 web api with a connected wcf service. On normal asp.net i can configure the basicHttpBinding in the web.config. But i can't find any solution to configurate the basicHttpBinding in asp.net core.

I have to set the transferMode="Streamed" and maxReceivedMessageSize="128108864".

Edit: it is a asp.net core 2.0 web api but with a full .net target framework


Solution

  • I have just encountered similar problems. So it seems that web.config is no longer available, because it's only used in IIS, and since Asp.net core 2 doesn't need IIS, web.config is irrelevant. I did try to add it though, but it wouldn't work.

    Best thing is to do it programmatically.

    BasicHttpBinding vidiBinding = new BasicHttpBinding();
    vidiBinding.MaxReceivedMessageSize = 2000000;
    
    EndpointAddress myEndPPtAdd = new EndpointAddress("http://localhost:9200/SilverlightVidiCloudService");
    
    VidiExternalCloudServiceClient myClient = new VidiExternalCloudServiceClient(vidiBinding, myEndPPtAdd);
    await myClient.OpenAsync();