Solved

Help moving a WCF web service on IIS6 from http to https

Posted on 2011-03-18
4
680 Views
Last Modified: 2012-05-11
In the past, I've create asmx web services. Now I've created my first web service in WCF, really by following a cookbook example. It deploys and runs fine on IIS6 under http. I'm running into problems moving it to https, though.

Asmx web services neither knew nor cared whether they were connected to via http or https - they weren't concerned with transport at all. All I had to do was install a cert in IIS, configure the SSL port, and I was in business.

WCF has lots of STUFF, like bindings, contracts, transport configurations, etc. No doubt after studying books and internet articles for a few weeks I could probably figure it out - the problem is I need to get running NOW!

There are actually two problems. One is the general problem that it won't work under SSL without correct configuration. The other is that the URL and Cert name is different from the server machine name, and if I browse to the service to try to obtain the WSDL, it returns a link to the machine name, not the proper URL.

Could someone help me to try to get this running under http? Greatly appreciate it.

Here's my current Web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
    </compilation>
  </system.web>
      <system.serviceModel>
            <behaviors>
                  <serviceBehaviors>
                        <behavior>
                              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                              <serviceMetadata httpGetEnabled="true" />
                              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                              <serviceDebug includeExceptionDetailInFaults="false" />
                        </behavior>
                  </serviceBehaviors>
            </behaviors>
            <serviceHostingEnvironment
      aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true"
      />
      </system.serviceModel>
      <system.webServer>
            <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>
</configuration>


0
Comment
Question by:psyche6
  • 3
4 Comments
 
LVL 15

Expert Comment

by:pcsmitpra
ID: 35178969
The other is that the URL and Cert name is different from the server machine name,
>>>> You need to get a Correct CERT with Correct domain name on it, Otherwise you will remain getting errors.

Is WCF working good without SSL ? Have you registered .svc extension manually . (How To)
You can get it working with SSL but first need to make its working fine without SSL, You can see here to see how to get it over the SSL

Cheers
0
 
LVL 1

Author Comment

by:psyche6
ID: 35193091
Re: pcsmitpra.

Please READ questions before answering! Is WCS working good without SSL? Go back and read: "It deploys and runs fine on IIS6 under http".

Your other link refers to working with SSL accelerators (if you don't know what they are, follow your own link!), and has nothing to do with my question.

Can I award NEGATIVE points?
0
 
LVL 1

Accepted Solution

by:
psyche6 earned 0 total points
ID: 35203589
I had to have it working now, so I paid for a Microsoft Support call. I sent him my Web.config file; he tweaked it and send it back:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
    </compilation>
    <identity impersonate="true"/>
  </system.web>
  <system.serviceModel>
    <!-- Region added for Https Support -->
    <bindings>
      <basicHttpBinding>
        <binding name="basicBindingConf">
          <security mode ="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="behavior" name="Psychemedics.SampleCollection">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicBindingConf"
          name="basicEndPoint" contract="Psychemedics.ISampleCollection" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <!-- Region added for Https Support -->
    <behaviors>
      <serviceBehaviors>
        <behavior name="behavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
</configuration>

It works - note that it's set up for https only, not both http and https. It also fixed the URL problem - when I browse to the service, it returns a correct URL link to the wsdl - not a link using the machine name rather than the correct certificate URL as it was doing before.

I actually almost understand all this ...

0
 
LVL 1

Author Closing Comment

by:psyche6
ID: 35230149
Didn't get an answer here - am posting paid Microsoft solution.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now