2

Currenlty there is a Wcf service hosted as windows service in one of our client side machine, actually currently this is working with normal http call. As we need to use https instead of http, for that we modified app.config but after starting the service the https url not working.Then we tried URL reservation by using netsh http add urlacl url=https://+:18732/Peripheral/ user=Everyone.Then we restared the service again it's not able to access the https url.

we are getting the error in the URl browser •Make sure that TLS and SSL protocols are enabled.

Is this related to any certificate issue? if so how we can able to solve this issue?

The web.config is provied below:-

<system.serviceModel>
<standardEndpoints />
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
  <bindings>
    <basicHttpBinding>
    <binding name ="soapBinding">
    <security mode="Transport">
    <transport clientCredentialType="None"/>
    </security>
    </binding>
    </basicHttpBinding>
    <webHttpBinding>
 <binding name="Bind1" crossDomainScriptAccessEnabled="true">
<security mode="Transport">
 <transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>  
    </bindings>
    <services>
      <service name="Peripheral.Server.Impl.PeripheralServiceImpl" behaviorConfiguration="SvcBhvr">
<host>
<baseAddresses>
  <add baseAddress="https://localhost:18732/Peripheral/" />
  </baseAddresses>
</host>
<endpoint address="https://localhost:18732/Peripheral/" binding="webHttpBinding" behaviorConfiguration="EndPBhvr" bindingConfiguration="Bind1" 
contract="Peripheral.Server.Contract.IPeripheralService">
 <!--<identity>
    <dns value="localhost" />
  </identity>-->
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EndPBhvr">
<webHttp /> 
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="SvcBhvr">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

Anyone knows how to fix this and what we needed to do so that we could able to access the url as https from windows services?

reapen
  • 705
  • 4
  • 13
  • 26
  • One thing to note is that in your config the endpoint element has the address set to https://localhost:18732/Peripheral/ which is not needed. Leave it empty. I am assuming that you are using self signed certificates and that is causing the problem. The easiest way to configure is to open IIS and add the port 18732 for https and then select the certificate that you wish to use. Then give it a try – Rajesh Sep 03 '13 at 09:50

1 Answers1

6

You may need also to bind ssl certificate to the specific port number using netsh or HttpConfig tool depending from OS version. Detailed instructions can be found here

In your case it could be:

netsh http add sslcert ipport=0.0.0.0:18732 certhash=<certhash> appid={<guid>} clientcertnegotiation=enable

where

certhash = your certificate Thumbprint(X509Certificate2.Thumbprint)

appid = could be just Guid.NewId()

Community
  • 1
  • 1
vitaliy zadorozhnyy
  • 1,226
  • 10
  • 12
  • based upon your information i added the above like : netsh>http add sslcert ipport=0.0.0.0:18732 certhash=023cb90fb13e33a475008efd6bf 6971e80293ce9 appid={F4710A2C-2DF1-408D-99F0-9861227ABDF8} clientcertnegotiation =enable but i am getting an error saying SSL Certificate add failed, Error: 1312 A specified log-on session does not exist. It may already have been terminated. What could be the possible reason for this error? – reapen Sep 03 '13 at 04:10
  • now it's added by providing the actual ip address of the system. but when trying to access the url it's asking for installing certificate. – reapen Sep 03 '13 at 04:57
  • It may be a problem with your certificate plz check this thread: http://stackoverflow.com/questions/13076915/ssl-certificate-add-failed-when-binding-to-port – vitaliy zadorozhnyy Sep 03 '13 at 04:59
  • YES - I've been trying to connect to a legacy WCF system installed on a NEW server, and couldn't figure out what was different!! days gone lol – Poat Oct 28 '22 at 15:11