开发者

Add WCF service to an ASP.NET MVC project

I'm trying to add a WCF service to my existing ASP.NET MVC web application, but with the WCF Test Client application, I keep getting HTTP 404 for the URL to the .svc file.

When I added the new WCF service to the project, it appeared to automatically make a bunch of changes to the web.config file. I tried hacking up my routes in global.asax file to ignore the .svc file, see if that helped — it didn't.

I have also edited the WCF configuration settings with the editor tool in Visual Studio to add the basic http endpoint thing.

I only need the WCF service for a very small part of my project to provide integration with another system that uses WCF extensively.

UPDATE: Here is some output from the WCF Test Client application 开发者_JAVA技巧when I add the URL http://localhost/LabManagerDev/Development/SoftwareRequests.svc in the provided dialog box.

Error: Cannot obtain Metadata from http://localhost/LabManagerDev/Development/SoftwareRequests.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 URI: http://localhost/LabManagerDev/Development/SoftwareRequests.svc Metadata contains a reference that cannot be resolved: 'http://localhost/LabManagerDev/Development/SoftwareRequests.svc'. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. The remote server returned an error: (401) Unauthorized. HTTP GET Error URI: http://localhost/LabManagerDev/Development/SoftwareRequests.svc There was an error downloading 'http://localhost/LabManagerDev/Development/SoftwareRequests.svc'. The request failed with HTTP status 404: Not Found.


In the global file (where global routing is configured) be sure to add a specific ignore for the svc file.


Two problems:

  1. Anonymous Authentication needed to be enabled
  2. WCF modules weren't registered with my IIS7 installation

From this site, had to run ServiceModelReg -i from the location "C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜