Click here to Skip to main content
12,886,892 members (35,528 online)
Rate this:
Please Sign up or sign in to vote.
See more: WCF
WCF and HTTPS, Error: There was no endpoint listening at, This is often caused by an incorrect address or SOAP action

I'm trying to configure a WCF Service to work over HTTPS and I'm having a lot of issues.

I was implementing https on my dev server with a self signed cert, everything worked fine. When I moved to production all the values for the urls were being read with the server's name instead of my website's address.

I added a host header to HTTPS on my web server which should enable me to avoid using static wsdl and xsd but does not. Without static values all urls defautl to the server's name.

So, I configured the service to have a static wsdl and xsd files that all contain https within their address. I then copied thoese files to my web site's directory so they are hosted. Those files are hosted within my website and the address being used all resolve correctly.

In my wsdl for my soad address I have a value with https. The https value is causing an error. When I replace https with http the service works but when

I check it with wire shark the data is not encrypted. Not good.
How can I get this working?

I have a test project I can submit for testing.
Here's the error I'm receiving:

There was no endpoint listening at https://MYSERVICE/GpTest/Service1.svc that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found
Server stack trace:
   at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at TestWcfHttps1Caller.ServiceReference1.IService1.DoAddition(Int32 value1, Int32 value2)
   at TestWcfHttps1Caller.ServiceReference1.Service1Client.DoAddition(Int32 value1, Int32 value2) in C:\www\releases\Test\WCF\TestWcfHttps1Caller\Service References\ServiceReference1\Reference.cs:line 123
   at TestWcfHttps1Caller._Default.Page_Load(Object sender, EventArgs e) in C:\www\releases\Test\WCF\TestWcfHttps1Caller\Default.aspx.cs:line 15
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Posted 8-Mar-11 5:26am
Updated 8-Mar-11 5:35am
Prerak Patel 8-Mar-11 23:36pm
I think you need to add you config code here.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I got it working, it took a combination of three different solutions

1. Enable HTTPS host header
2. Enable static wsdl and xsd files
3. Configure web.config

So, to enable HTTPS for WCF I had to

1. Crate static wsdl and xsd files

Ok, how?
1.1 following ?wsdl link and save as .wsdl file type. Modify the file and change soad address to https. You'll link to this file from your dev server since your live server will most likely have a link to the server's name and not the url you actually want to use
1.2 in .wsdl file create an .xsd file for each xsd link within the wsdl (ie: xsd0.xsd, xsd1.xsd, xsd2.xsd)
1.3 update all reference to the xsd documents in the wsdl file and xsd files to use the new xsd files you created. Point to the hosted values using the url you want to use, all address should now be using https
1.3 host all those files in the root of your web app and test that each url resolves correctly
1.4 Note: each time you make changes to the service you will need to rebuild all the static files in this manner

2. Enable HTTPS host header on the live IIS server (no gui for this, must use command line)

3. Modify Service web config to include Transport Security mode and HTTPS in the following attributes (find "https" in web.config below)

Here's my web.config file

    <compilation debug="true" targetFramework="4.0" />
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
      <service  behaviorConfiguration="TestWcfHttps1.Service1" name="TestWcfHttps1.Service1">
        <endpoint address="https://MYSERVER/GpTest/Service1.svc" 
            <dns value="" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        <behavior name="TestWcfHttps1.Service1">
          <serviceMetadata httpsGetEnabled="true" externalMetadataLocation="https://MYSERVER//GpTest/Service1.wsdl" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
    <modules runAllManagedModulesForAllRequests="true"/>
kamalsamant 6-Apr-12 6:11am

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 8 Apr 2016
Copyright © CodeProject, 1999-2017
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