Add basic authentication to WCF Service hosted in a Windows service - wcf

How can I add basic authentication to a WCF service hosted in a Windows service?
I added a security tag to my binding, but I don't get an authentication window when I call the service url in the browser. What am I doing wrong/what am I missing?
<bindings>
<basicHttpBinding>
<binding name="MyDefaultBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000">
<readerQuotas maxDepth="500" maxArrayLength="20000000" maxStringContentLength="20000000"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>

You will not get that authentication window when you just access the service helper page. The authentication is configured for service endpoint - not for helper page or WSDL (those are "separate endpoints").
Try to modify your configuration:
<bindings>
<customBinding>
<binding name="securedPages">
<textMessageEncoding messageVersion="None" />
<httpsTransport authenticationScheme="Basic" />
</binding>
<customBinding>
<basicHttpBinding>
<binding name="MyDefaultBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000">
<readerQuotas maxDepth="500" maxArrayLength="20000000" maxStringContentLength="20000000"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="securedService">
<serviceMetadata httpGetEnabled="true" httpGetBinding="customBinding"
httpGetBindingConfiguration="securedPages" />
<serviceDebug httpHelpPageEnabled="true" httpHelpPageBinding="customBinding"
httpHelpPageBindingConfiguration="securedPages" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="..." behaviorConfiguration="securedService">
...
</service>
</services>

Related

WCF - Return large data set to Client

The goal is to send the contents of a table as a data set to the client. I get an error from the client application:
"The maximum message size quota for incoming messages (65536) has been exceeded."
Although in the same WCF application retrieving large data amount from the client there is no error.
Please see the config file.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
<bindings>
<wsHttpBinding>
<binding name="TeansferBinding"
messageEncoding="Mtom"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
receiveTimeout="00:10:00">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"/>
<!--
For forced HTTPS
change the security mode from None to Transport and add Transport key with clientCredentialType="None"
<security mode="Transport">
<transport clientCredentialType="None"/>
</security
-->
<security mode="None" />
</binding>
<binding name="ProjectBinding"
messageEncoding="Text"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
receiveTimeout="00:10:00">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"/>
<!--
For forced HTTPS
change the security mode from None to Transport and add Transport key with clientCredentialType="None"
<security mode="Transport">
<transport clientCredentialType="None"/>
</security
-->
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="TransferBehavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<!-- 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"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" maxConcurrentInstances="500"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="TransferBehavior" name="TransferServer.Restore" >
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="TeansferBinding"
contract="TransferServer.IRestore"/>
<!-- remove mex endpoint of production server -->
<endpoint address="mex"
binding="mexHttpBinding"
name="Mex"
contract="IMetadataExchange"/>
<host>
<timeouts closeTimeout="00:10:00" openTimeout="00:10:00"/>
</host>
</service>
<service behaviorConfiguration="TransferBehavior" name="TransferServer.ProjectProvider">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="ProjectBinding"
contract="TransferServer.IProjectProvider"/>
<!-- remove mex endpoint of production server -->
<endpoint address="mex"
binding="mexHttpBinding"
name="Mex"
contract="IMetadataExchange"/>
<host>
<timeouts closeTimeout="00:10:00" openTimeout="00:10:00"/>
</host>
</service>
</services>
I've searched for a solution but only come back to the adjustment of the config file. The WCF application is not reporting any error and the client is reporting the error.
I've tried using wsHttpBinding and basicHttpBinding with no success. I've tried MTOM and Text message encoding.
#Abraham Qian
App Config File for Client
Here is the App.Config file for the client.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IRestore" messageEncoding="Mtom">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="WSHttpBinding_IProjectProvider">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://myServer.com/Restore.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IRestore"
contract="RestoreProvider.IRestore" name="WSHttpBinding_IRestore" />
<endpoint address="https://myServer.com/ProjectProvider.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IProjectProvider"
contract="ProjectProvider.IProjectProvider" name="WSHttpBinding_IProjectProvider" />
</client>
</system.serviceModel>
</configuration>
As for the binding information for the ProjectProvider service the only difference is "maxBufferSize" which when inserted creates an error.
Usage code in the Client
Public sub GetZips()
'Get the information from Ops
Using oProjectProvider As New ProjectProvider.ProjectProviderClient
MyDataSet = oProjectProvider.GetZipCodeData
oProjectProvider.Close()
End Using
Application.DoEvents()
End sub
I would like to know the client configuration. how do you create a call to the service? We had better apply the configuration on both the client-side and the server-side. Besides, I suspect there is something wrong with the client service endpoint address. Please post the complete client configuration.
In addition, please refer to the below configuration.
<binding maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
Feel free to let me know if the problem still exists.

Configuration to Enable HTTPS WCF Web Service on an Azure Web Role

I’ve searched through several posts (here and here, for example) related to this area, but none seem to address this fairly straight forward scenario question: What Binding configurations should be used to configure an SSL enabled (e.g. https) WCF Web Service on an Azure Web Role: in the Web Role’s ServiceDefinition.csdef, the Web Service’s web.config and the client’s app.config?
I have configured the SSL cert for the service in the Azure Portal and in the Web Role’s ServiceConfiguration.csfg for https:// MyApp.cloudapp.net and this appears to be working fine.
When I browse to the service https:// myapp.cloudapp.net/WCFService.svc?wsdl , the metadata displays correctly. I can add a Service Reference to the service from a client, but when I call it, I get the exception: “There was no endpoint listening at https:// myapp.cloudapp.net/WCFService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.” Inner Exception: “The remote server returned an error: (404) Not Found”
The respective configuration files look like this:
ServiceDefinition.csdef :
<WebRole name="WCFServiceWebRole" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="HttpIn" endpointName="HttpIn" />
<Binding name="HttpsIn" endpointName="HttpsIn" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="8080" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="MySSLCert" />
</Endpoints>
<Certificates>
<Certificate name="MySSLCert" storeLocation="LocalMachine" storeName="My" />
</Certificates>
</WebRole>
Web Service’s web.config :
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
The Client’s App.Config looks like this:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyWebService" >
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://myapp.cloudapp.net/MyWebService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyWebService"
contract="MyWebServiceServiceReference.IMyWebService"
name="BasicHttpBinding_IMyWebService" />
</client>
</system.serviceModel>
When I use SvcUtil to generate the binding configuration for the client, it generates:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyWebService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://myapp.cloudapp.net/MyWebService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyWebService"
contract="MyWebServiceServiceReference.IMyWebService" name="BasicHttpBinding_IMyWebService" />
</client>
</system.serviceModel>
Which then gives the exception when I call the web service: "The provided URI scheme 'https' is invalid; expected 'http'." So that doesn't seem to be the correct configuration either.
I’m sure this is just a matter of getting the right configuration in the three files above, but I can’t seem to find the correct combination anywhere, and so I would really appreciate if someone could call out what they should be.
Conor.
An Azure dev helped me figure out the answer to this, the problem was the omission of the Service node from the Web Service's web.config file. Here is the full set of configuration files required for this scenario in case it helps anyone else trying to achieve the same result (An SSL/HTTPS WCF Web Service implemented on an Azure Web Role:
ServiceDefinition.csdef :
<WebRole name="WCFServiceWebRole" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="HttpIn" endpointName="HttpIn" />
<Binding name="HttpsIn" endpointName="HttpsIn" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="8080" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="MySSLCert" />
</Endpoints>
<Certificates>
<Certificate name="MySSLCert" storeLocation="LocalMachine" storeName="My" />
</Certificates>
</WebRole>
Web Service’s web.config :
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="" name="MyWebServiceNameSpace.MyWebService">
<endpoint bindingConfiguration="BasicHttpBinding" address="" binding="basicHttpBinding"
contract="MyWebServiceNameSpace.IMyWebService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
The Client’s App.Config looks like this:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyWebService" >
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://myapp.cloudapp.net/MyWebService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyWebService"
contract="MyWebServiceServiceReference.IMyWebService"
name="BasicHttpBinding_IMyWebService" />
</client>
</system.serviceModel>
Thanks, works for me too!
I made some changes removing the certificates section in the service definition.
<WebRole name="WCFServiceBizagiCloud" vmsize="Standard_D1_v2">
<Sites>
<Site name="Web">
<Bindings>
<!--<Binding name="Endpoint1" endpointName="Endpoint1" />-->
<Binding name="HttpIn" endpointName="HttpIn" />
<Binding name="HttpsIn" endpointName="HttpsIn" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<!--<InputEndpoint name="Endpoint1" protocol="http" port="80" />-->
<InputEndpoint name="HttpIn" protocol="http" port="8080" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" />
</Endpoints>
<!--<Certificates>
<Certificate name="MySSLCert" storeLocation="LocalMachine" storeName="My" />
</Certificates>-->
</WebRole>

WCF call times out when the returned message is large

We have a system where a client flash application is calling an asmx based Search web service which in turn calls a wcf service hosted in a windows service using NetTcpBinding. This is working fine when the no. of search results are small. But when the Search results are going large, in the range of 2000 records, we are getting an exception in the asmx service where it calls the wcf:
`The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.`
In order to troubleshoot the error, we enabled service tracing and found that the error reported is:
`The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'.`
We have increased the timeout values in both server and client configs and also increased the maxItemsInObjectGraph value. There are no errors happening at the wcf call as we can debug it and the observed behavior is, when the wcf call returns, the code in the asmx service is hitting the exception block and reporting the above error.
Server Side Config:
<system.serviceModel>
<services>
<service name="***.SearchController" behaviorConfiguration="serviceBehavior">
<endpoint address="net.tcp://localhost:8228/SearchController" binding="netTcpBinding" contract="***.ISearch" name="SearchController" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceDebug includeExceptionDetailInFaults="True" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="LargeMessageBinding"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxConnections="2147483647"
maxReceivedMessageSize="2147483647"
portSharingEnabled="false"
transactionFlow="false"
listenBacklog="2147483647"
closeTimeout="infinite"
openTimeout="infinite"
receiveTimeout="infinite"
sendTimeout="infinite">
<security mode="None">
<message clientCredentialType="None"/>
<transport protectionLevel="None" clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<diagnostics wmiProviderEnabled="true">
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
<client></client>
Client(axms) Side Config:
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:8228/SearchController" binding="netTcpBinding" behaviorConfiguration="endpointBehavior" contract="***.ISearch" name="NewSearch"/>
</client>
<bindings>
<netTcpBinding>
<binding name="LargeMessageBinding"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxConnections="2147483647"
maxReceivedMessageSize="2147483647"
portSharingEnabled="false"
transactionFlow="false"
listenBacklog="2147483647"
closeTimeout="infinite"
openTimeout="infinite"
receiveTimeout="infinite"
sendTimeout="infinite">
<security mode="None">
<message clientCredentialType="None"/>
<transport protectionLevel="None" clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="endpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
The code using which the wcf gets called from the asmx service:
List<***.SearchResult> results;
using (var searchFactory = new ChannelFactory<***.ISearch>("NewSearch"))
{
Legacy.ISearch searchProxy = searchFactory.CreateChannel();
results = searchProxy.Search(searchOption);
}
This call is reporting the exception.
We are not sure why we are getting a timeout issue even after increasing the thresholds in the config. Could it be that the service is not picking up our binding config and using some default config values and hence throwing the error. Not sure what is the way to validate if the service has actually picked up our config at runtime.
Need help in troubleshooting this issue.
you must use binding in your application, but you declare it only, use bindingConfiguration property
<endpoint address="net.tcp://localhost:8228/SearchController" binding="netTcpBinding" contract="***.ISearch" name="SearchController" bindingConfiguration="LargeMessageBinding" />
and bindingConfiguration="LargeMessageBinding" to client config too

Problem calling WCF service internet

I am developing a WCF service that will be called by customer in internet. The service is hosted in IIS7 and accept only http. For clients call us from https we do is have a reverse proxy that forwards the request to the application https to http. The customer give a https url to connect and does so smoothly, adding the reference to the service properly. The problem comes when trying to create a client and add in your endpoint https and execute it, as it reads:
System.ArgumentException: The provided URI scheme 'https' is invalid,
expected 'http'. Parameter name: via.
I leave part of the service's web.config:
<bindings>
<wsHttpBinding>
<binding name="ConfigEP">
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://serverInterno/App/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<services>
<service behaviorConfiguration="App.AppM_NameBehavior" name="App.AppM_Name">
<endpoint address="" behaviorConfiguration="App.AppM_NameEPBehavior" binding="wsHttpBinding" bindingConfiguration="ConfigEP" name="App.AppM_NameEP" bindingNamespace="http://siteName/AppM_Name" contract="App.IAppM_Name" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="App.AppM_NameEPBehavior">
<wsdlExtensions location="https://urlsegura/App/Appm_Name.svc" singleFile="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="App.AppM_NameBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceCredentials>
<clientCertificate>
<authentication customCertificateValidatorType="App.Validador, App" certificateValidationMode="Custom" />
</clientCertificate>
<serviceCertificate findValue="XX XX XX XX XX XX XX XX XX XX" x509FindType="FindBySerialNumber" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
and here the client's app.config:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="NewBehavior">
<clientCredentials>
<clientCertificate findValue="XX XX XX XX XX XX XX XX XX XX" x509FindType="FindBySerialNumber" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="App.AppM_NameEP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="Certificate" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://urlsegura/App/Appm_Name.svc" binding="wsHttpBinding" bindingConfiguration="App.AppM_NameEP" contract="App.IAppM_Name" name="App.AppM_NameEP">
<identity>
<certificate encodedValue="XXXX" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Thanks in advance.
Best regards.
I think your error is being caused because you're using message based security on your configuration. Try changing it to Transport instead (in both the client and service configuration files), so that it uses SSL for security rather than encrypting the message.
You can use TransportWithMessageCredential if you absolutely must have the message encrypted also. Hope that helps.
I don't understand the reverse proxy you describe but it seems you're trying to support access from both HTTP & HTTPS. To do this, you will need to add a second endpoint. You'd configure the service something like this:
<wsHttpBinding>
<binding name="ConfigEP">
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
<binding name="ConfigEPHttps">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
and this add the new endpoint:
<service behaviorConfiguration="App.AppM_NameBehavior" name="App.AppM_Name">
<endpoint address="" behaviorConfiguration="App.AppM_NameEPBehavior"
binding="wsHttpBinding"
bindingConfiguration="ConfigEP"
name="App.AppM_NameEP"
bindingNamespace="http://siteName/AppM_Name"
contract="App.IAppM_Name" />
<endpoint address="secure" behaviorConfiguration="App.AppM_NameEPBehavior"
binding="wsHttpBinding"
bindingConfiguration="ConfigEPHttps"
name="App.AppM_NameEPHttps"
bindingNamespace="http://siteName/AppM_Name"
contract="App.IAppM_Name" />
</service>
You also need make this change to get the WSDL over HTTPS:
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />

WCF and SSL - No endpoint found error, 404

Please, oh, please, please, please help!!! :-)
I am trying to test out WCF with SSL and seem to be missing something. I have done a ton of searching and can't seem to find what I'm missing with the config. I have a basic WCF service hosted in IIS on Windows 7 with a self-signed certificate. I also have a test client web application calling that WCF service.
I am getting the following error in the test client:
There was no endpoint listening at https://<url>/WcfAuthTest/Service1.svc that could accept the message.
I can navigate to the service in a browser and get the standard auto-generated page for a SOAP service.
Here is the config for the WCF Service:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsSecureBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="wsSecureBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="wsSecureBehavior" name="Service1">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecureBinding" name="wsService1" contract="WcfAuthTest.IService1" />
<endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="" name="MexHttpsBindingEndpoint" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
The client config is:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsTestBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://<url>/WcfAuthTest/Service1.svc"
binding="wsHttpBinding" bindingConfiguration="wsTestBinding"
contract="ServiceReference1.IService1" name="wsTestBinding" />
</client>
Hi I know its been a while since you asked this question.
I am having similar problems with WCF and SSL and just thought you might resolve your problem by setting the property in the Service Behaviours httpsGetEnabled="true"
setting this property enabled me to get to the next stage of problems :)
At the end of your config you have:
<endpoint address="https://<url>/WcfAuthTest/Service1.svc"
binding="wsHttpBinding" bindingConfiguration="wsTestBinding"
contract="ServiceReference1.IService1" name="wsTestBinding" />
<url> looks like it starts but never ends.