将WCF服务/ IIS 7.5配置为仅使用https绑定。 [英] Configure WCF-Service / IIS 7.5 to use only https binding.

查看:137
本文介绍了将WCF服务/ IIS 7.5配置为仅使用https绑定。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在配置承载WCF服务的ASP.NET Web应用程序时遇到了一些问题。我现在已经搜索了很长一段时间。说实话,有很多结果,我不是WCF的专家。大多数解决方案是为wsHttpBinding(我不使用)或显示与我得到的错误相关的ErrorMessages。



这是什么我想完成:

只能通过特定端口上的https绑定访问WCF服务(例如https://example.org:5555/MyService.svc\")



这是我当前的问题:

我可以通过https://example.org成功访问该服务: 5555 / MyService.svc

但是

我必须在IIS7.5中配置一个http绑定(如果它指向localhost和一个无意义的端口就足够了只要它已配置...)



在MyService.svc上发出获取请求时出现错误消息(使用CustomErrors =Off)

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.





我从中可以理解,可能会缺少某些配置。但是,如果存在IIS中的http和https绑定,为什么它应该工作,但如果只存在https绑定则不行?



我的问题:

能够删除http绑定所需的步骤是什么?





任何帮助都将是真的很感激:)



其他信息:

- 该服务在IIS 7.5上运行正常。如果为网站配置了https绑定(例如ipAll Unassigned和端口5555)和http绑定(例如ip:: 1(localhost)和端口55555)。

- 尽快因为我在IIS中执行以下任一步骤。应用程序停止工作:

- 删除http绑定

- 在IIS中设置要求SSL - > SSL设置为真。



ConfigFile的内容:



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 :)

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>





MyService的内容.svc(简体):





Content of MyService.svc (simplified):

<%@ ServiceHost Service="CustomNamespace.MyServiceImpl" %>

< br $>


MyServiceImpl.cs的内容(简化)



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();
      }

   }

}

推荐答案

你说过你你试过几件事,你读过这篇文章并尝试过它吗?



在WCF WsHttp绑定上启用HTTPS的七个简单步骤 [ ^ ]
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[^]


这篇关于将WCF服务/ IIS 7.5配置为仅使用https绑定。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆