Click here to Skip to main content
Rate this: bad
good
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
rob723201
Edited 8-Mar-11 5:35am
v3
Comments
Prerak Patel at 8-Mar-11 23:36pm
   
I think you need to add you config code here.
Rate this: bad
good
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
 
<system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service  behaviorConfiguration="TestWcfHttps1.Service1" name="TestWcfHttps1.Service1">
        <endpoint address="https://MYSERVER/GpTest/Service1.svc" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="TransportSecurity"
                  contract="TestWcfHttps1.IService1">
          <identity>
            <dns value="" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="TestWcfHttps1.Service1">
          <serviceMetadata httpsGetEnabled="true" externalMetadataLocation="https://MYSERVER//GpTest/Service1.wsdl" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>
  Permalink  
v4
Comments
kamalsamant at 6-Apr-12 6:11am
   
rwer
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Thank you very much. I have applied your solution. it is working fine
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 265
1 _Amy 235
2 Peter Leow 205
3 Andreas Gieriet 180
4 Shmuel Zang 120
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,412
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 2 Jun 2014
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