【发布时间】:2016-04-19 05:39:52
【问题描述】:
我在 VS2010 中创建了一个 Web 应用程序和 WCF Web 服务。它在本地运行良好。我想将 Web 应用程序和服务部署到测试服务器。应用程序和服务将位于同一台服务器上。我将应用程序和服务发布到服务器,并为应用程序 Paging 创建了一个应用程序池。我将应用程序和服务添加到 IIS 的 Site 文件夹中,并将它们转换为应用程序。
当我尝试访问应用程序时,我收到 404 错误。我相信这是因为我需要启动 Web 服务。当它在本地运行时,我从 VS2010 项目启动 Web 服务,然后启动 Web 应用程序。我不是也必须在 Web 服务器上启动 Web 服务吗?我该怎么做?
应用程序和 Web 服务文件夹位于以下文件夹中:C:\inetpub\wwwroot2\PagingService 和 C:\inetpub\wwwroot2\PagingTool。在访问我尝试过的 Web 服务http://localhost/PagingService/PagingService.Paging.svc 时,我收到错误消息: 主机上配置的身份验证方案 ('Ntlm') 不允许在绑定 'WSHttpBinding' ('Anonymous') 上配置的身份验证方案。
应用程序和 Web 服务在我的本地计算机上运行良好,我是否必须更改身份验证,因为它位于 Web 服务器上?操作系统是 Windows Server 2008。
这是我用于连接的 app.config 文件:
<services>
<service name="PagingService.Paging" behaviorConfiguration="SimpleServiceBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPaging" contract="PagingService.IPaging">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/PagingService/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IPaging"
maxReceivedMessageSize="20000000"
maxBufferPoolSize="20000000"
sendTimeout="00:25:00">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</wsHttpBinding>
</bindings>
任何建议将不胜感激。
谢谢。
【问题讨论】:
-
在您的 IIS 中确保您的 Web 服务的匿名身份验证设置为“已启用”。
-
谢谢!更改该设置后,我能够在本地连接到 Web 服务,但使用 localhost/PagingService/PagingService.Paging.svc。但是当我尝试远程启动应用程序时,我收到 500 错误。有什么建议吗?
-
似乎在 web.config 文件中 ReportViewerWebControlHandler 条目给出了这个错误:无法添加类型为“add”的重复集合条目,其唯一键属性“name”设置为“ReportViewerWebControlHandler”
-
我删除了这个条目,ReportViewerWebControlHandler,应用程序现在可以工作了
-
@Hakunamatata - 添加此问题的答案,以便我接受。
标签: c# asp.net web-services visual-studio-2010 wcf