开发者

Prevent HttpHandler from handling WCF requests

I have a web site that hosts a WCF service and an HttpHandler. When I turn on aspNetCompatibilityEnabled the HttpHandler starts picking up my WCF requests. I would not think this could happen because it has a .svc extention and the handlers are not configured to handle .svc files. The handler is registered as so:

<system.webServer>
<handlers>
  <add name="TTPDeploy" path="*.deploy" verb="*" type="ServiceHost.DeploymentHandler" resourceType="Unspecified" preCondition="integratedMode" />
  <add name="TTPManifest" path="*.manifest" verb="*" type="ServiceHost.DeploymentHandler" resourceType="Unspecified" preCondition="integratedMode" />
  <add name="TTPApplication" path="*.application" verb="*" type="ServiceHost.DeploymentHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
</handlers>
</system.webServer>

I'm sure this is simply because I don't understand something about WCF and HttpHandlers. Thoughts?


Update

I ended up solving the problem in a different way. Because I couldn't get my WCF requests to work while having aspNetCompatibilityEnabled set to true, I reverted it back 开发者_运维技巧to false.

My core problem was that I needed to get the physical file path to my web from with a WCF call. I found another post (which I'm unable to find now) that stated when using WCF to get the physical application path, you should use HostingEnvironment.ApplicationPhysicalPath. This is a much more straight forward approach to the problem, but still doesn't answer this question.

Why does my handler pick up my WCF requests when it's not registered to .svc files?


IIS is picking up the request due to some config, could be in machine.config.

To allow the request to get to your handler, add the following to your web.config file:

<compilation>     
 <buildProviders>         
  <remove extension=".svc" />     
 </buildProviders> 
</compilation> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜