我遇到了创建Web服务并在SharePoint 2010中托管它的问题。我在阳光下阅读每个博客都无济于事。将已部署的服务添加为对另一个项目的引用时,出现以下错误:
下载时出错 'HTTP://nb-dev-sp2010/_vti_bin/NBICWebServices/NBICAgencyService.svc'。 请求因空响应而失败。元数据包含一个 无法解决的参考: 'HTTP://nb-dev-sp2010/_vti_bin/NBICWebServices/NBICAgencyService.svc'。 服务器没有提供有意义的回复;这可能是由 合同不匹配,过早的会话关闭或内部 服务器错误。如果在当前解决方案中定义了服务,请尝试 构建解决方案并再次添加服务引用。
我将以下内容作为web.config文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NBICBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="NBICWebServices.INBICAgencyService">
<endpoint address="http://localhost/_vti_bin/NBICWebServices/NBICAgencyService.svc"
binding="basicHttpBinding" bindingConfiguration="NBICBinding"
contract="NBICWebServices.INBICAgencyService" name="NBICBindingAgency" />
</service>
</services>
<!--
<client>
<endpoint address="http://localhost/_vti_bin/NBICWebServices/NBICAgencyService.svc"
binding="basicHttpBinding" bindingConfiguration="NBICBinding"
contract="NBICWebServices.INBICAgencyService" name="NBICBindingAgency" />
</client>
-->
</system.serviceModel>
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</configuration>
有人能在这看到问题吗?是的,我知道我不应该进行匿名身份验证。我稍后会回到那个问题。 : - )