问题描述
我最近创建了一个 WCF 服务,该服务在 Visual Studio 2008 中测试时运行良好.但是当我将项目部署到 IIS 并尝试从 IIS 访问 .svc 文件时,我收到此错误:
I recently created a WCF service that works fine when tested from Visual Studio 2008. but when I deploy the project to IIS and I try to access the .svc file from IIS, I get this error :
"Server Error in '/' Application.The resource cannot be found. "
过去 4 天我一直遇到这个问题.
I've been having this issue for the past 4 days .
在 IIS 管理器的处理程序映射中,我可以看到 .svc 的两个条目:
in the Handler Mappings of IIS Manager, I can see two entries for .svc :
svc-Integrated and svc-ISAPI-2.0
推荐答案
您需要为 SVC 扩展添加到 ASP.NET 的映射.最简单的方法是从 C:WindowsMicrosoft.NETFrameworkv3.0Windows Communication Foundation 运行 ServiceModelReg.exe -i
.如果您还没有启用 ASP.NET,您可能还需要启用.
You need to add a mapping for the SVC extension to ASP.NET. The easiest way to do this is to run ServiceModelReg.exe -i
from C:WindowsMicrosoft.NETFrameworkv3.0Windows Communication Foundation. You may also need to enable ASP.NET if you haven't already done so.
如果您使用的是 Windows Server 2012 或 2016,请改为按照以下说明操作:
If you are using Windows Server 2012 or 2016, follow these instructions instead:
这篇关于访问 IIS 中的 .svc 文件时出现 HTTP 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!