Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF .NET4 IIS7.5
I've got a few problems configuring an ASP.NET Webapplication which hosts a WCF Service. And I've been searching quite a while now. There are quite a lot of results to be honest, and I'm not an expert with WCF. Mostly the solutions are either for the wsHttpBinding (which i don't use) or showing ErrorMessages not associated with the one I get.
 
This is what I want to accomplish:
Access the WCF Service only through https binding on specific port (eg. "https://example.org:5555/MyService.svc")
 
This is my current problem:
I can successfully access the service at "https://example.org:5555/MyService.svc"
BUT
I have to configure a http binding in IIS7.5 (it's sufficient if it points to the localhost and a nonsense port as long as it's configured...)
 
The error Message when making a get request on MyService.svc (with CustomErrors="Off")
Service 'CustomNamespace.MyService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
 
I do understand from that, that there might be some configuration missing. However why should it work if http and https binding in IIS are present, but not if only https binding is present?
 
My Question:
What are the steps necessary to be able to remove the http binding?
 

Any help will be truly appreciated Smile | :)
 
Additional Info:
- The service works fine on IIS 7.5. if a https binding (e.g. ip "All Unassigned" and port 5555) AND http binding (e.g. ip "::1"(localhost) and port 55555) are configured for the site.
- As soon as I do either of the following steps in IIS. The application stops working:
- Remove the http binding
- Set "Require SSL" in IIS -> "SSL Settings" to true.
 
Contents of ConfigFile:
<?xml version="1.0"?>
<configuration>
   <system.serviceModel>
      <bindings>
         <basicHttpBinding>
            <binding>
               <security mode="Transport">
                  <transport clientCredentialType="None" />
               </security>
            </binding>
         </basicHttpBinding>
      </bindings>
      <behaviors>
         <serviceBehaviors>
            <behavior>
               <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
               <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
         </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
   </system.serviceModel>
</configuration>
 
Content of MyService.svc (simplified):
 
<%@ ServiceHost Service="CustomNamespace.MyServiceImpl" %>
 
Content of "MyServiceImpl.cs" (simplified)
namespace CustomNamespace {   
 
   public interface IMyService {
 
      [OperationContract(Name = "doSomething", Action = "", ReplyAction = "*")]
      [XmlSerializerFormat]
      CustomReplyType DoSomething(CustomType request)
 
   }
 
   public class MyServiceImpl : IMyService {
 
      public CustomReplyType DoSomething(CustomType request) {
         // Do Stuff
         return new CustomReplyType();
      }
 
   }
 
}
Posted 7-May-13 6:21am

1 solution

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

Solution 1

You said you've tried a few things, have you read this article and tried its approach?
 
Seven simple steps to enable HTTPS on WCF WsHttp bindings[^]
  Permalink  
Comments
Nicholas Marty at 7-May-13 14:06pm
   
Hm. I'm not looking for enabling https (which is working) but disabling http (with that meaning the unsecured connection) ;). Also this article seems more to address iis6 on a local machine than wcf and ssl in general. Will still take a look at it. :)

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



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 7 May 2013
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