.NET Framework Bookmark and Share   
 index > Windows Communication Foundation > WCF Http.Sys
 

WCF Http.Sys

Hi I am getting following error when i run wcf services

An error occurred while making the HTTP request to https://localhost:8732/Design_Time_Addresses/DemoService/HeaderService/. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

Please help with this

Result from httpcfg query ssl:

c:\Program Files\Microsoft Visual Studio 9.0\VC>httpcfg query ssl
IP : 0.0.0.0:8732
Hash : cd2e7afb5804332cf87e80ea60c645d3db81d53
Guid : {00000000-0000-0000-0000-000000000000}
CertStoreName : (null)
CertCheckMode : 0
RevocationFreshnessTime : 0
UrlRetrievalTimeout : 0
SslCtlIdentifier : (null)
SslCtlStoreName : (null)
Flags : 0
------------------------------------------------------------------------------



Service config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="DemoService.HeaderService" behaviorConfiguration="DemoService.HeaderServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost:8732/Design_Time_Addresses/DemoService/HeaderService/" />
<add baseAddress="http://localhost:8181/Design_Time_Addresses/DemoService/HeaderService/" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="DemoService.IGetHeaders" bindingConfiguration="SecurityDemo"></endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport" >
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DemoService.HeaderServiceBehavior">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<windowsAuthentication allowAnonymousLogons="True"/>
<serviceCertificate findValue="OlbDevelopment" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

Client Config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="99999"/>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
<message clientCredentialType="Windows"/>
</security>
</binding>

</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:8732/Design_Time_Addresses/DemoService/HeaderService/"
binding="wsHttpBinding" bindingConfiguration="SecurityDemo" behaviorConfiguration="CertificateDemo"
contract="DemoService.IGetHeaders"
name="IGetHeaders">
<headers>
<MyHeader name="Sample" xmlns="http://tempuri.org">This is my header data</MyHeader>
</headers>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="CertificateDemo">
<clientCredentials>
<clientCertificate findValue="OlbDevelopment" storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>


Nilay Patel
Hi,
can you find that your security setting in client does not match the server setting?
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport" >
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>

please change server config
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
<message clientCredentialType="Windows"/>
</security>
</binding>

</wsHttpBinding>

By the way,
I do not know what s clientCredentialType type you want to use?
None or Certificate?
You can down load sample codes for all of them:

1.WCF分布式安全开发实?5):传输安全模式之Certificate身份验证:Transport_Certificate_WSHttpBinding
http://www.cnblogs.com/frank_xl/archive/2009/08/13/1543848.html

/Files/frank_xl/4.1.WCFServiceSecurityDemoFrankXuLei_Transport_Certificate_WSHttpBinding.rar

2.WCF分布式安全开发实?1):传输安全模式之匿名客户端:Transport_None_WSHttpBinding
http://www.cnblogs.com/frank_xl/archive/2009/08/13/1543848.html

/Files/frank_xl/1.1.WCFServiceSecurityDemoFrankXuLei_Transport_None_WSHttpBinding.rar

regards

Frank Xu Lei--谦卑若愚,好学若?
专注?NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
Frank Xu Lei
Hi,
can you find that your security setting in client does not match the server setting?
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport" >
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>

please change server config
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
<message clientCredentialType="Windows"/>
</security>
</binding>

</wsHttpBinding>

By the way,
I do not know what s clientCredentialType type you want to use?
None or Certificate?
You can down load sample codes for all of them:

1.WCF分布式安全开发实?5):传输安全模式之Certificate身份验证:Transport_Certificate_WSHttpBinding
http://www.cnblogs.com/frank_xl/archive/2009/08/13/1543848.html

/Files/frank_xl/4.1.WCFServiceSecurityDemoFrankXuLei_Transport_Certificate_WSHttpBinding.rar

2.WCF分布式安全开发实?1):传输安全模式之匿名客户端:Transport_None_WSHttpBinding
http://www.cnblogs.com/frank_xl/archive/2009/08/13/1543848.html

/Files/frank_xl/1.1.WCFServiceSecurityDemoFrankXuLei_Transport_None_WSHttpBinding.rar

regards

Frank Xu Lei--谦卑若愚,好学若?
专注?NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
Frank Xu Lei
Hi Thanks for your reply. I am trying to host service using ssl.

i changed server config as follows:

<system.serviceModel>
<services>
<service name="DemoService.HeaderService" behaviorConfiguration="DemoService.HeaderServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost:8732/Design_Time_Addresses/DemoService/HeaderService/" />
<add baseAddress="http://localhost:8181/Design_Time_Addresses/DemoService/HeaderService/" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="DemoService.IGetHeaders" bindingConfiguration="SecurityDemo"></endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport" >
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DemoService.HeaderServiceBehavior">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<serviceCertificate findValue="OlbDevelopment" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>


Client config as follows:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="99999"/>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport">
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:8732/Design_Time_Addresses/DemoService/HeaderService/"
binding="wsHttpBinding" bindingConfiguration="SecurityDemo" behaviorConfiguration="CertificateDemo"
contract="DemoService.IGetHeaders"
name="IGetHeaders">
<headers>
<MyHeader name="Sample" xmlns="http://tempuri.org">This is my header data</MyHeader>
</headers>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="CertificateDemo">
<clientCredentials>
<clientCertificate findValue="OlbDevelopment" storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>



Still it is not working.
Nilay Patel
Hi ,

Please have a look at this blog.
http://riquel-iam.spaces.live.com/blog/cns!A0C5DF86C111116A!219.entry?&_c02_vws=1

Also have these two videos for your reference:
WCF - Self hosting with SSL
http://rocksolidknowledge.com/ScreenCasts.mvc

Basic Authentication Windows Accounts
http://www.cloudcasts.net/ViewWebcast.aspx?webcastid=2521599800441327007
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong
I tried to follow the steps that webcast is showing but it is still not working. Is it because i am trying to host it on winxp pro on virtual machine?
Nilay Patel
Hi Nilay,

In my blog you can see how to host WCF service via self-host and IIS. That works for me. If it doesn't work in your scenario, please give more information about error information so that we can discuss it here.

Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong

You can use google to search for other answers

Custom Search

More Threads

• WCF not handling <detail> element in SOAP Faults correctly
• Caller was not authenticated by the service
• Socket programming in WCF
• Servicehost & begintryreceive
• WCF "Contexts" ??
• Custom names/namespaces/etc in WCF WSDL
• WebServiceHost and CustomMessageEncoder issue
• WCF Project Design - better than Web Service Software Factory
• ServiceHost does not respond to the Close() call
• Issue defining mutiple endpoints