C# 如何发布WCF Rest Web服务?
我的App.config:C# 如何发布WCF Rest Web服务?,c#,visual-studio,web-services,rest,iis,C#,Visual Studio,Web Services,Rest,Iis,我的App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service name="WcfJsonRestService.Service1"> <endpoint address="http://localhost/webservice"
<?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/getUsers
我会收到一份用户列表。当我将Web服务发布到IIS时出现问题,因为http://localhost/webservice/getUsers
返回HTTP错误404.0-未找到
有什么建议吗?你可以试试这个
您可以使用默认设置配置匿名身份验证
匿名用户帐户(IUSR),也可以设置本地用户帐户
对于匿名用户
- 如果要配置IIS用于访问站点或应用程序的特定用户帐户,请选择“特定用户”。然后单击“设置”以打开“设置凭据”对话框,并为标识输入用户名和密码。然后单击OK
- 如果希望使用当前在应用程序池的属性页上指定的帐户运行IIS进程,请选择应用程序池标识。默认情况下,此标识是IUSR帐户。(重要提示:如果使用IUSR帐户,则向匿名用户授予与该帐户关联的所有内部网络访问权限。)
您可以使用链接作为参考。您的站点在IIS中是否具有身份验证?在“连接方式”中检查站点的基本设置@RGdent我有“应用程序用户(通过身份验证)”选项。在“连接方式…”旁边单击“测试设置…”应该有两个结果:“身份验证”和“授权”。它们旁边都应该有一个绿色的复选标记。授权时显示黄色(无法验证访问路径(C…))看一看,这帮我解决了这个问题,检查了第3步的身份验证,也是一篇不错的文章。希望能有帮助。
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