Translate

> > WCF wsHttpBinding sample configaration

WCF wsHttpBinding sample configaration

Posted on Sunday, February 17, 2013 | No Comments

Service Config Sample

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime executionTimeout="90800" maxRequestLength="2147483647" />
  </system.web>

  <connectionStrings>
    <clear/>
    <!--<add name="MT_ConnectionString"
      connectionString="Data Source=DATASRV;Initial Catalog=report;Persist Security Info=True;User ID=me;Password=Me2012"
      providerName="System.Data.SqlClient" />-->
    <add name="MT_ConnectionString"
      connectionString="Data Source=PGTONMOY-PC\NOKIA;Initial Catalog=HShopMT;Persist Security Info=True;User ID=sa;Password=data"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.serviceModel>
    <services>
      <service name="MT_WService.MTService" behaviorConfiguration="ServiceBehavior">
        <!-- Service Endpoints -->
        <endpoint address="MTService" behaviorConfiguration="EndPointBehavior" binding="wsHttpBinding"
            contract="MT_WService.IMTService" bindingConfiguration="WSHttpBinding_IMTService">
          <identity>
            <dns value="apps.mediasoftbd.com" />
          </identity>
        </endpoint>
        <!-- This Endpoint is used for genertaing the proxy for the client -->
        <!-- To avoid disclosing metadata information, set the value below to false and
       remove the metadata endpoint above before deployment -->
        <endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding" />
        <host>
          <baseAddresses>
            <add baseAddress="http://127.0.0.1/MTService/"/>
          </baseAddresses>
        </host>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="1909600"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="EndPointBehavior">
          <dataContractSerializer maxItemsInObjectGraph="1909600"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>

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

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 
 
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
 
</configuration>

Application Configuration sample

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <connectionStrings>
    <add name="MT_ConnectionString"
      connectionString="Data Source=NOKIA;Initial Catalog=ShopMT;Persist Security Info=True;User ID=sa;Password=sa21"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IMTService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:50:00" sendTimeout="00:50:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2000000000" maxReceivedMessageSize="2000000000"
          messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
          allowCookies="false">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:50:00"
            enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="false"
              algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/MT/MTService.svc/MTService"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMTService"
          contract="MTService.IMTService" name="WSHttpBinding_IMTService"
                behaviorConfiguration="EndPointBehavior">
        <identity>
          <dns value="apps.mediasoftbd.com" />
        </identity>
      </endpoint>
    </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="EndPointBehavior">
          <dataContractSerializer maxItemsInObjectGraph="1909600"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Leave a Reply

Powered by Blogger.