Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF minimal client app.config settings

What are the minimal client settings i need to do for a streamlined WCF config in the app.config?

The default one is this:

    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        algorithmSuite="Default" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>

What can I exclude, and how much of that do i need?


Edit: Should i just start ripping out parts till it breaks? I was hoping to find some good optimized wsHttpBindings that people have good luck with.

like image 808
Tom Anderson Avatar asked Jan 15 '09 23:01

Tom Anderson


People also ask

What are 3 basic WCF configurations required for hosting a WCF service?

There are three types of hosting environments for WCF services: IIS, WAS, and self-hosting. The term “self-hosting” refers to any application that provides its own code to initialize the hosting environment. This includes console, Windows Forms, WPF, and managed Windows services.

What is configuration Svcinfo?

configuration.svcinfo: Contains a snapshot of the configuration generated for the client service endpoint for the local (app|web).config. configuration91. svcinfo: For each property in config, contains an XPath to the setting and the original value stored in config.

What is binding configuration in WCF?

WCF achieves this by configuring binding attributes of an endpoint. WCF lets you choose HTTP or TCP transport protocol, encoding, etc. just by tweaking the value of binding attribute for an endpoint. To cater to different transport protocols, WCF lets you select HTTP, TCP and MSMQ binding types.

How will you specify a method is available to access by client in WCF?

With the service running, right click the project that will contain the WCF client proxy and select Add > Service Reference. In the Add Service Reference Dialog, type in the URL to the service you want to call and click the Go button. The dialog will display a list of services available at the address you specify.


3 Answers

Jerograv is right, given that these are all defaults you can omit all of them. To test this I've created a simple service and created the minimal config required which is pretty much the address, the binding and the contract-

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <client>
            <endpoint address="http://sabra2/TestService/Service1.svc" binding="wsHttpBinding"
                contract="IService1"/>
        </client>
    </system.serviceModel>
</configuration>
like image 199
Yossi Dahan Avatar answered Oct 06 '22 04:10

Yossi Dahan


Just remember the ABC's of WCF. Address, Binding, Contract. That's all you need!

Your client only has to have an endpoint to talk to a WCF Service. Each endpoint only needs to describe each of the ABC's and you're done. The other stuff can be tacked on later.

That's one reason I'm not a big fan of adding Service References in Visual Studio.

like image 45
Tad Donaghe Avatar answered Oct 06 '22 04:10

Tad Donaghe


I think you'll find that all of that is optional. All of those things in that particular binding are the defaults anyway.

In fact I think specifying the binding at all in the endpoint would be optional in this case.

like image 32
Jero Avatar answered Oct 06 '22 02:10

Jero