开发者

REST WCF Service hosting(https) in Windows Service on Win2003

开发者 https://www.devze.com 2023-03-15 06:25 出处:网络
I am self hosting a REST WCF service in Windows service. The service exposes a method which returns a boolean and I am able to get the REST webservice to work on WinXp. I also generated a development

I am self hosting a REST WCF service in Windows service. The service exposes a method which returns a boolean and I am able to get the REST webservice to work on WinXp. I also generated a development certificate using makecert and assigned it to the port(1443) that the service listens on. Https also works well on WinXp. But When I use the same in Win2003, and type the URL in IE, it says "The page cannot be displayed". There were no errors in hosting the service, the service listens on the port(the ServiceHost.Open didnt have any errors and its successful). Is there an settings that has to be done in Win2003 for this? Win2003 is the production environment and https has to work on that.

Here is the config file I used,

 <system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="httpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service behaviorConfi开发者_JS百科guration="spectrumServiceBehavior" name="MyApp.TestService">
    <host>
      <baseAddresses>
        <add baseAddress="https://localhost:1443/" />
      </baseAddresses>
    </host>
    <endpoint address=""
              binding="webHttpBinding"
              bindingConfiguration ="httpBinding"
              contract="MyApp.ITestService" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="spectrumServiceBehavior">
      <!-- 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="true" />
      <serviceMetadata httpsGetEnabled ="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

Any ideas?


I've experienced the same problem. WinXP development environment working with HTTPS, certificate created locally and assigned to a custom port with httpcfg. Production environment on Windows 2003 with the imported certificate and the same httpcfg configuration giving "interrupted connection" while trying to obtain the WSDL of the service.

Looking at the Windows log I finally found this error:

Event Source: Schannel

A fatal error occurred when attempting to access the SSL server credential private key. The error code returned from the cryptographic module is 0x80090016.

My problem was that I imported the certificate in the user-account store, and then copied in the local store. In this way the private-key is left behind... http://support.microsoft.com/kb/939616 (without even a warning!!!) despite, opening the certificate in the new location, shows the presence of a private-key!


I expect that on Windows 2003 you must allow application to listen on port (unless it runs as admin) and you must assign SSL certificate to the port - both is performed by httpcfg.exe. Also check that there is no firewall blocking the communication on the port.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号