Solved

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

Posted on 2011-03-18
4
686 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
#SSL #TLS #Citrix #HTTPS #PKI #Compliance #Certificate #Encryption #StoreFront #Web Interface #Citrix XenApp
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 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

10 Experts available now in Live!

Get 1:1 Help Now