【发布时间】:2011-01-08 22:41:04
【问题描述】:
我在我的开发机器上构建了一个 WCF Web 服务。我构建了服务,创建了一个测试客户端,测试了一切,它工作正常。我开始对这个 WCF 的东西感觉很好。然后我很勇敢,把它移到了我的生产服务器上。
目前,生产服务器位于 WinHost.com。我有我的测试域 www.MyDomain.com,创建了一个应用程序文件夹 /websvc,并将 Web 服务文件复制到其中。服务地址为http://www.MyDomain.com/websvc/eval.svc
现在我已移至生产服务器,我无法使用 Web 服务。我收到此错误 - “此集合已包含带有方案 http 的地址。”我用谷歌搜索了解决方案的消息,尝试了一些,但这只会导致其他错误。所以我重置了所有内容,然后重新开始。
根据上面的服务地址,我的 web.config 应该是什么样子的?具体来说,我的端点应该如何看待它?
这是我现在所拥有的......
<configuration>
<system.serviceModel>
<services>
<service name="EvalServiceLibrary.EvalService">
<endpoint address="http://www.MyDomain.com:80/websvc/mex"
binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="http://www.MyDomain.com:80/websvc/basic"
binding="basicHttpBinding" contract="EvalServiceLibrary.IEvalService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
【问题讨论】:
-
这是您在尝试使用应用程序中的服务时收到的消息吗?启用
includeExceptionDetailInFaults,然后在您的浏览器中导航到该服务的位置。它会显示什么?顺便说一句,您在问题中列出的地址与 Web.config 文件中的端点地址不匹配。 -
能否指出端点地址的区别?我没有看到它。当我尝试访问 MyDomain.com:80/websvc/eval.svc/basic 时,错误消息显示在我的浏览器中
-
描述中的地址是
websvc/eval.svc,而配置中的地址是basic。
标签: visual-studio-2008 wcf .net-3.5