Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows service Web
I am developing a web service that needs to sit on a secure server. I've done this in the web config:
<behaviors>
    <serviceBehaviors>
        <behavior name="StdBehavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
    </serviceBehaviors>
</behaviors>
 
<bindings>
    <basicHttpBinding >
        <binding name="secureBinding">
            <security mode="Transport">
                <transport clientCredentialType="Certificate" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>
 
<services>
    <service behaviorConfiguration="StdBehavior" name="A.DevelopmentSvc">
        <host>
            <baseAddresses>
                <add baseAddress="https://blah/blah/CrisSvc"/>
            </baseAddresses>
        </host>
        <endpoint address="/" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="secureBinding" 
                  name="devEndpoint" contract="CrisCodeWcf.ICrisSvc" 
                  />
        <endpoint address="mex" 
                  binding="mexHttpsBinding" 
                  name="mexEndpoint" 
                  contract="IMetadataExchange" 
                  />
    </service>
</services>
...but I get this error when I try to browse to the service in IE:
 
Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https].
Posted 2-Feb-12 3:45am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hi John,
 
I usually run svcutil directly, using a batch file. This has a few benefits, chief among them is that you don't need to talk to a running service.
 
svcutil is capable of generating the required code based on your service definition from the implementation assembly.
 
Here is the contents of a batch file I use for this purpose:
 
SETLOCAL
 
rem set up path so svcutil can be found
call c:\usr\bin\initvc.cmd
 

SET ROOTDIR=C:\Src\AjaWorks\AjaWorks.Oracle.Tools
 
rem this is where the service implmentation assembly is located
SET WCFSERVICEDIR=%ROOTDIR%\Goodtech.Databox.DX.DataService\bin\Debug
 
SET WCFSERVICECLIENTDIR=%ROOTDIR%\Generated
 
rem this assembly contains types shared between the client and server
SET COMMONTYPESDLL=%ROOTDIR%\Generated\bin\Debug\Goodtech.Databox.DX.dll
 

cd %WCFSERVICECLIENTDIR%\wsdl
 
rem let svcutil generate wsdl
svcutil %ROOTDIR%\Goodtech.Databox.DX.DataService\bin\Debug\Goodtech.Databox.DX.DataService.dll
 
CD %WCFSERVICECLIENTDIR%\Client
 
rem let svcutil generate code ( service reference )
svcutil %WCFSERVICECLIENTDIR%\wsdl\*.wsdl %WCFSERVICECLIENTDIR%\wsdl\*.xsd /namespace:*,Goodtech.Databox.DX.Client /targetClientVersion:Version35 /language:C# /ct:System.Collections.Generic.List`1 /out:DataServiceReference.cs /config:GeneratedApp.config /reference:%COMMONTYPESDLL%
 
ENDLOCAL
 
A typical solution will usually have at least:
  • An assembly for types shared between client and server
  • An assembly for the service implementation
  • A windows forms application that hosts the service implementation - for development purposes
  • A windows service that hosts the service implementation - for deployment
  • A client API assembly that wraps the code generated by svcutil, adds logging, connection handling, etc.
  • The client application
 
Everything that determines how the client and server talks to each other goes into the application configuration files.
 
Best regards
Espen Harlinn
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It appears that you can't use the basicHttpBinding under the bindings for https, check this link where they had the exact same problem and used webhttpbinding.
 
WCF Bindings needed for HTTPS[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I guess, you cannot use clientCredentialType="Certificate" with basicHttpBinding.
 
try using clientcredentialtype="None".
 
Edit: Another point to make:
 
you have written:
 <serviceMetadata httpGetEnabled="true"/>
I guess it needs to be:
<behavior name="StdBehavior">
          <serviceMetadata httpsGetEnabled="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
  Permalink  
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

As others have pointed out the binding will probably need to change; something like wsHttpBinding. I have found this link to msdn helpful:
 
Common Security Scenarios[^]
 
Also, to get your wsdl you will probably need to turn on:
<servicemetadata httpsgetenabled="true"></servicemetadata>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 205
1 Richard MacCutchan 185
2 DamithSL 170
3 Tomas Takac 146
4 OriginalGriff 132
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 3 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100