Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I have a wcf rest web service hosted client as windows service. To upload images i did following modifications in wcf webconfig file

<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
             maxArrayLength="2147483647" maxBytesPerRead="2147483647"
             maxNameTableCharCount="2147483647" />
        </binding>
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service behaviorConfiguration="" name="WCFWeb.Service1">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:63230/service1.svc/"/>
          </baseAddresses>
        </host>
        <endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" contract="WCFWeb.IService1" />
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp helpEnabled="true" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>

  </system.serviceModel>


But the binding are not working when i hosted as windows service.
Here is the c# code
Uri httpUrl = new Uri(ConfigurationManager.AppSettings["BaseUrl"]);
WebServiceHost host = new WebServiceHost(typeof(WCFWeb.Service1), httpUrl);

ServiceMetadataBehavior mBehave = new ServiceMetadataBehavior();
host.Description.Behaviors.Add(mBehave);
WebHttpBinding httpBinding = new WebHttpBinding();
httpBinding.MaxBufferPoolSize = 2147483647;
httpBinding.MaxReceivedMessageSize = 2147483647;
httpBinding.MaxBufferSize = 2147483647;
httpBinding.TransferMode = TransferMode.Streamed;
httpBinding.ReaderQuotas.MaxDepth = 2147483647;
httpBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
httpBinding.ReaderQuotas.MaxArrayLength = 2147483647;
httpBinding.ReaderQuotas.MaxBytesPerRead = 2147483647;
httpBinding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
host.AddServiceEndpoint(typeof(WCFWeb.Service1), httpBinding, httpUrl);
host.Open();

When i apply code AddServiceEndpoint all my services become down. Kindly hepl me
Posted
Updated 11-Apr-15 2:03am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900