【发布时间】:2015-11-09 11:28:13
【问题描述】:
我的 App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="WcfJsonRestService.Service1">
<endpoint address="http://localhost/webservice"
binding="webHttpBinding"
contract="WcfJsonRestService.IService1"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我将我的网络服务发布到http://localhost/webservice 目标,但是当我在浏览器中打开http://localhost/webservice/ 时,我得到了这个:
localhost - /webservice/
[To Parent Directory]
11/9/2015 10:30 AM <dir> bin
11/9/2015 11:23 AM 58 WcfJsonRestService.Service1.svc
11/9/2015 11:22 AM 481 Web.config
这在调试模式下运行良好。我只是做http://localhost/webservice/getUsers 并收到用户列表。当我将 web 服务发布到 IIS 时会出现问题,因为http://localhost/webservice/getUsers 返回HTTP Error 404.0 - Not Found。
有什么建议吗?
【问题讨论】:
-
您的站点是否在 IIS 中进行了身份验证?在“连接身份”中检查您网站的基本设置
-
@RGdent 我有“应用程序用户(直通身份验证)”选项。
-
是的,在“连接为...”旁边单击“测试设置...”应该有两个结果:“身份验证”和“授权”,它们旁边都应该有一个绿色复选标记给他们。
-
授权时显示黄色(无法验证访问路径 (C....)))
-
看看this,这有助于我解决此问题,检查身份验证的第 3 步,但也是好文章。希望对您有所帮助。
标签: c# visual-studio web-services rest iis