WCF REST over HTTPS

I'm developing a REST web service using WCF, C# and .NET Framework 4.0.

I have followed this tutorial to create my own certificate and use IIS Express as development server.

But now, I don't know why, I can't access my web service if I use https instead of http.

This is IIS Express applicationhost.config:

<site name="MyGameWCFService" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="D:\Fuentes\CSharp\Test\MyLib\MyGameWCFService" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:7342:localhost" />
        <binding protocol="https" bindingInformation="*:44300:localhost" />
        <binding protocol="https" bindingInformation="*:443:Melnibone" />
    </bindings>
</site>

And this is my WCF web.config:

<?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=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="MyGameWCFService.MyGameService"
               behaviorConfiguration="MyGameServiceBehaviour">
        <endpoint address=""
                  contract="MyGameWCFService.IMyGameService"
                  behaviorConfiguration="restfulBehavior"
                  binding="webHttpBinding"
              bindingConfiguration="WebHttpBindingConfig"  />
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="WebHttpBindingConfig">
          <security mode="Transport"/>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="restfulBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="MyGameServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
  <connectionStrings>
    <add name="MyGameContext"
          providerName="System.Data.SqlClient"
          connectionString="Server=.\SQLEXPRESS;Database=MyGame;Integrated Security=True;MultipleActiveResultSets=True"/>
  </connectionStrings>
</configuration>

I can access web service with this url: http://localhost:7342/MyGameService.svc/users, but I can't if I use the other ones: https://localhost:4430/MyGameService.svc/users and https://Melnibone:443/MyGameService.svc/users.

I'm testing it on the same computer (I'm testing it on Melnibone).

When I access it from https://localhost:44300/MyGameService.svc/users I get a HTTP 404 Not Found.

Any advice?

Answers


To founding this answer I checked all http bindings and spent about half a day. But I have got it! Make changes to your config, like this:

<services>
   <service behaviorConfiguration="Default" name="Service_Name">
    <endpoint behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="httpsBinding" contract="Contract.IContract" />
   </service>
  </services>
  <bindings>
    <webHttpBinding>
     <binding name="httpsBinding">
        <security mode="Transport" />
     </binding>
     </webHttpBinding>
   </bindings>
  <behaviors>
   <endpointBehaviors>
    <behavior name="webBehavior">
     <webHttp />
    </behavior>
   </endpointBehaviors>
   <serviceBehaviors>
    <behavior name="Default">
     <serviceMetadata httpsGetEnabled="true" />
    </behavior>
   </serviceBehaviors>
  </behaviors>

Need Your Help

How to select a row's text from a UITableView Xamarin.ios c#

c# ios xamarin xamarin.ios

I am wanting to select the text from a row in my table, I've done some searching but I can't seem to find an example in Xamarin.ios I think that I am wanting something similar to this

Not getting message from resource bundle

java spring internationalization

I have configured the Spring configuration xml to use the "ResourceBundleMessageSource" and I am trying to get the message from the resource bundle file but while I am to to execute I get the log o...