0

我正在尝试研究如何在使用城堡温莎的 sharepoint 2010 中托管 wcf 服务。通过使用来自http://msdn.microsoft.com/en-us/library/ff521586(v=office.14).aspx的服务工厂之一,我可以毫无问题地托管我自己的标准自定义 Web 服务. 使用 Castle Windsor 设置正常的 wcf 服务涉及修改 global.asax,但由于 SharePoint 不建议这样做,我创建了一个 HttpModule 来设置容器,并更新了 Web 配置以通过创建功能接收器来使用它. 我的问题是下一步该去哪里。我正在为我的服务使用 MultipleBaseAddressBasicHttpBindingServiceHostFactory,因为它会根据 IIS 配置动态配置服务的所有端点,但是为了使用 Castle Windsor,看起来有必要更改为使用提供的 Castle.Facilities.WcfIntegration.WindsorServiceHostFactory . 我试过只是切换看看会发生什么,但这似乎不起作用。我收到以下错误

Error: Cannot obtain Metadata from <svc url> If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: <svcurl>    Metadata contains a reference that cannot be resolved: '<svcurl>'.    The requested service, '<svcurl>' could not be activated. See the server's diagnostic trace logs for more information.HTTP GET Error    URI: <svcurl>    There was an error downloading '<svcurl>'.    The request failed with HTTP status 404: Not Found.

我认为这是因为我没有为服务配置端点,但我在网上看到的几个例子似乎也没有。

有没有人设法让城堡温莎和 sharepoint wcf 工作 - 如果可能的话最好使用动态配置?

4

1 回答 1

0

您收到的错误消息是服务的元数据未发布。为此,您需要两件事:

您的服务的 mex 端点:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

并在服务行为中开启服务元数据:

  <serviceMetadata httpGetEnabled="True"  />
于 2013-07-14T19:11:51.413 回答