【发布时间】:2013-12-10 20:30:17
【问题描述】:
我正在阅读 WCF 4.0 Multi-tier Services Development 一书,并尝试使用 IIS 使用 WCF 实现一个简单的 Hello World。
我有一个 HelloWorldService 项目和一个 HostDevServer 项目(启动项目)。我应该看到一个目录监听了两个文件,但我收到了下一条错误消息:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
最可能的原因:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
我做了什么:
- 在 IIS 管理器中启用目录浏览
- 检查我是否有默认文档,它们存在。
- 运行命令:appcmd set config /section:system.webServer/directoryBrowse /enabled:true
在 IIS 的关于屏幕上显示版本 7.5,在浏览器中显示“IIS 8.0 详细错误...”。我不知道这是否与问题有关。
我使用 Visual Studio 2013 进行开发。 Web.config 如下:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
有人知道如何解决这个问题吗?
【问题讨论】:
-
你能发布一个 web.config 吗?
-
用 web.config 更新了帖子。
-
我通常怀疑您的服务所在文件夹的权限。确保 IUSR 和/或(我不记得是哪个)IIS_IUSRS 对您硬盘上的 Web 服务文件夹具有读取权限。或者,如果您的 appPool 在不同的凭据集上运行,则对这个用户帐户执行相同操作。