tags:

views:

148

answers:

3

Hello,

We currently have a WCF Service that works over https. But we want to change it to make it work over just http.

Could any one tell me what all do I need to change to make the the wcf service work over http. Below is my config file values. Is there anything I else I need to cahnge other than the web.config??

ANy help greatly appreciated

<system.serviceModel>
   <serviceHostingEnvironment>
      <baseAddressPrefixFilters>
        <add prefix="myservername" />
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
    <bindings>
      <basicHttpBinding>
          <binding name="basicHttpBinding_Windows" 
              maxReceivedMessageSize="500000000"  maxBufferPoolSize="500000000" 
              messageEncoding="Mtom">
              <security mode="TransportWithMessageCredential">
                 <transport clientCredentialType="Windows" />
              </security>
              <readerQuotas maxDepth="500000000"
                 maxArrayLength="500000000" maxBytesPerRead="500000000"
                 maxNameTableCharCount="500000000" maxStringContentLength="500000000"/>
          </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
       <endpointBehaviors>
         <behavior name="myproject_Behavior">
            <dataContractSerializer />
            <synchronousReceive />
         </behavior>
       </endpointBehaviors>
       <serviceBehaviors>
          <behavior name="WebService.WSBehavior">
             <serviceMetadata httpsGetEnabled="true" />
             <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
          <behavior name="WebService.Forms_WSBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
          </behavior>
       </serviceBehaviors>
    </behaviors>
    <services>
       <service behaviorConfiguration="WebService.WSBehavior"
                name="IMMSWebService.mywebservice_WS">
           <endpoint 
               address="myproject_WS" 
               binding="basicHttpBinding" 
               bindingConfiguration="basicHttpBinding_Windows"
               bindingName="basicHttpBinding" 
               contract="WebService.ICommand">
               <identity>
                  <dns value="localhost" />
               </identity>
           </endpoint>
           <endpoint address="mex" 
                     binding="mexHttpsBinding" 
                     contract="IMetadataExchange" />
           <host>
              <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
           </host>
       </service>
       <service behaviorConfiguration="WebService.Forms_WSBehavior"
                name="WebService.Forms_WS">
           <endpoint 
                address="" 
                binding="wsHttpBinding" 
                contract="WebService.IForms_WS">
                <identity>
                   <dns value="localhost" />
                </identity>
           </endpoint>
           <endpoint address="mex" 
                     binding="mexHttpBinding" 
                     contract="IMetadataExchange" />
       </service>
    </services>
  </system.serviceModel>
A: 

Change

  <security mode="TransportWithMessageCredential">

To

  <security mode="None">

Also change

<endpoint address="mex" 
                 binding="mexHttpsBinding" 
                 contract="IMetadataExchange" />

to

  <endpoint address="mex"
              binding="mexHttpBinding"
              contract="IMetadataExchange" />

and finally any occurrence of

httpsGetEnabled to httpGetEnabled

Nix
I changed my config file to NOne and when I try to get to service from the IE I get this error Could not find a base address that matches scheme http for the endpoint with binding basicHttpBinding. Registered base address schemes are [https]. Any help on what to do next on this
Crishna
see edit above httpsGetEnabled="true"
Nix
That didnt help either. I still get the same error
Crishna
you original question was to fix the security issue. Sorry i only looked at the security section you need to fix address="myproject_WS" by putting the url you want.
Nix
I tried 2 things 1.) changing the adress = "url" and also 2.) adding a base address tag in the service element. Both the times I get the same error "Could not find a base address that matches scheme http for the endpoint with binding basicHttpBinding. Registered base address schemes are [https]. "Is there any thing I am seriously doing wrong? Thanks for all your answers
Crishna
See above there was a mexHttpBinding we missed, and once you validate it works, please post your final config so we can see if we can eliminate some unnecessary stuff.
Nix
A: 

I changed my config file to NOne and when I try to get to service from the IE I get this error Could not find a base address that matches scheme http for the endpoint with binding basicHttpBinding. Registered base address schemes are [https]. Any help on what to do next on this

Crishna
A: 

For your second problem with the base addresses: create a <baseAddresses> element in your service tag:

<services>
  <service behaviorConfiguration="WebService.WSBehavior"
    name="IMMSWebService.mywebservice_WS">
    <endpoint 
        address="myproject_WS" 
        binding="basicHttpBinding" 
        bindingConfiguration="basicHttpBinding_Windows"
        bindingName="basicHttpBinding" 
        contract="WebService.ICommand">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses> 
         <add baseAddress="http://yourserver:8181/YourServiceBase" />
      </baseAddresses>
      <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
    </host>
  </service>

or use fully qualified addresses on your endpoints

<services>
  <service behaviorConfiguration="WebService.WSBehavior"
    name="IMMSWebService.mywebservice_WS">
    <endpoint 
        address="http://yourserver:8181/YourServiceBase/myproject_WS" 
        binding="basicHttpBinding" 
        bindingConfiguration="basicHttpBinding_Windows"
        bindingName="basicHttpBinding" 
        contract="WebService.ICommand">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
    </host>
  </service>
marc_s
I created a based address element in the service service tab and I still get the same error"Could not find a base address that matches scheme http for the endpoint with binding basicHttpBinding. Registered base address schemes are [https]. "
Crishna
Can you show us the base address you are using? Also: have you switch your MEX endpoint to use mexHttpBinding instead of mexHttpsBinding, too? Have you switched your serviceMetadata behavior to use httpGetEnabled instead of httpsGetEnabled ??
marc_s