-
February 26th, 2014, 10:06 AM
#1
webservice using https
I've tried to configure my ws to run https, but with no luck.
When I try to access the WS using https, it just times out.
I hope someone can help
My web.config:
Code:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" 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>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
<!--<remove scheme="http"/>-->
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="WillisWebService.willis">
<endpoint address="https" binding="basicHttpsBinding" contract="WillisWebService.Iwillisws" name="https_WillisWS" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
-
February 26th, 2014, 09:19 PM
#2
Re: webservice using https
What does the WCF server configuration look like?
-
February 27th, 2014, 02:26 AM
#3
Re: webservice using https
I have just the web.config, and I'm running on VS2012's built-in webserver. The only other config I could thing off is the IIS machine.config when I deploy (but I haven't done that yet).
Edit:
I have changed my IIS settings (I'm now deploying there rather than use the VS2012 built-in webserver) to allow SSL, and I've made my own certificate (for now).
Web.config now looks like this:
Code:
<?xml version="1.0"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<!-- REMOVED -->
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" 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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
<!--<remove scheme="http"/>-->
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="WillisWebService.willis">
<!--<host>
<baseAddresses>
<add baseAddress = "http://localhost/WebServices/Willis/" />
<add baseAddress = "https://localhost/WebServices/Willis/" />
</baseAddresses>
</host>-->
<endpoint address="" binding="basicHttpBinding" contract="WillisWebService.Iwillisws" name="http_WillisWS" bindingConfiguration="httpbinding" />
<endpoint address="" binding="basicHttpsBinding" contract="WillisWebService.Iwillisws" name="https_WillisWS" bindingConfiguration="httpsbinding"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="httpbinding">
</binding>
</basicHttpBinding>
<basicHttpsBinding>
<binding name="httpsbinding">
<security>
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpsBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
This seems to work.
What puzzles me, is that when I look at the app.config of my client app, it seems things are not 100% https....
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<!-- REMOVED -->
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="http_WillisWS" />
<binding name="https_WillisWS">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://f0-win7030713.telecare.dk/WebServices/Willis/willis.svc"
binding="basicHttpBinding" bindingConfiguration="http_WillisWS"
contract="ServiceReference1.Iwillisws" name="http_WillisWS" />
<endpoint address="https://f0-win7030713.telecare.dk/WebServices/Willis/willis.svc"
binding="basicHttpBinding" bindingConfiguration="https_WillisWS"
contract="ServiceReference1.Iwillisws" name="https_WillisWS" />
</client>
</system.serviceModel>
</configuration>
Why is that and what, if anything, needs to be changed.
Last edited by Lars_V_J; February 27th, 2014 at 07:54 AM.
-
February 27th, 2014, 07:55 AM
#4
Re: webservice using https
Also: can I remove the part that deals with normal http? And if so, can people still autogenerate client code?
-
February 27th, 2014, 02:19 PM
#5
Re: webservice using https
Originally Posted by Lars_V_J
Also: can I remove the part that deals with normal http? And if so, can people still autogenerate client code?
Probably, but try it to verify.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|