English 中文(简体)
How to enforce one method in WCF Rest to be called via https, while others can be called over http
原标题:
  • 时间:2010-01-29 22:00:23
  •  标签:
  • wcf
  • wcf-rest

Is there a way in a WCF Rest Service implementation to require one method be called over https, while allowing others to be called over http or https without having to define two service endpoint bindings? I want to be able to do something in my service implementation such as:

if (CalledOverHttps()) {
   //Do Stuff
} else {
   throw new WebOperationException("Nice try buddy");
}

Thanks in advance!

最佳回答

I handled this with IIS, and requiring https on a virtual directory. So in my directory structure i have:

non secured: http://foo.com/someservice.svc

secured: https://foo.com/secure/someservice.svc

and if you tried http://foo.com/secure/someservice.svc, an appropriate 500 error is thrown by IIS.

问题回答

I m not entirely sure, but I believe you can configure it in the bindings.

I have to look it up, though.





相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签