Search code examples
asp.net-mvcwcfforms-authenticationiis-5

How can I expose a WCF Service in a Virtual Directory w/o Forms Authentication?


My group builds internally hosted ASP.NET MVC websites with forms-authentication.

I'd like to host a WCF service in the same virtual directory as an ASP.NET MVC website.

My Question:

How do I make the WCF service freely accessible, that is without forms-authentication.

My current predicament is this:

  • I can access the .svc and see the wsdl information if I first authenticate through forms-authentication with a web browser.
  • But when I try to access the WCF service with wcfTestClient.exe, I get the following error:

Error: Cannot obtain Metadata from http://localhost/Services/MyService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error


Solution

  • Many thanks to all who tried to answer this question.

    After hours of troubleshooting this problem, I discovered that a custom authentication module was rejecting my client attempts to get the metadata. Suffice it to say, I needed to route around this logic.

    Oh - And stepping through the code is very underrated. ;)