WCF service med HTTPS - Problem!
Hej Eksperten,Jeg har indtil videre kun rodet med WCF uden sikkerhed. Men da jeg skal sende lidt data over nettet tænkte jeg det ville være smart med noget sikkerhed. Så jeg har forsøgt mig hele morgenen at få HTTPS til at virke.
Min App.config ser pt. sådan ud (Bemærk det er en C# Windows Service og altså ikke til IIS):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="sqlconnectionstring" connectionString="Data Source=xxx; Initial Catalog=xxx; User ID=xxx; Password=x" />
</connectionStrings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceMetadata httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="Binding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="NewBehavior"
name="WCFData.WCFDataService">
<endpoint
address="https://localhost:10081/WCFsite"
binding="basicHttpBinding"
bindingConfiguration="Binding"
contract="WCFData.IWCFDataService" />
<host>
<baseAddresses>
<add baseAddress="https://localhost:10081/WCFsite" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
Servicen starter, men forsøger jeg at browse https://localhost:10081/WCFsite så kommer "Internet Explorer cannot display the webpage". Og prøver jeg at tilføje adressen som "Service Reference" i min klient, så får jeg:
There was an error downloading 'https://localhost:10081/WCFsite'.
The underlying connection was closed: An unexpected error occurred on a send.
Authentication failed because the remote party has closed the transport stream.
Metadata contains a reference that cannot be resolved: 'https://localhost:10081/WCFsite'.
An error occurred while making the HTTP request to https://localhost:10081/WCFsite. 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.
The underlying connection was closed: An unexpected error occurred on a send.
Authentication failed because the remote party has closed the transport stream.
If the service is defined in the current solution, try building the solution and adding the service reference again.
--
Hvad mangler jeg / Gør jeg forkert?
Mvh.
ZazzY