我正在尝试将SP Web部件部署到新的SP服务器。我读到在部署之前我需要首先设置WCF服务。我拥有了Web部件首次部署时使用的所有文件,并通过一些行更改验证了在新的SP服务器上重新编译代码应该没问题。
这些文件已经有一个.svc文件,经过验证可以正常使用。我正在尝试按照托管WCF服务的指南进行操作,因为我已经有了.svc,所以我有点迷失了。我知道它并不像放在/ _vti_bin文件夹中那么简单,所以我该如何处理?
注意:我没有对服务器的物理访问权限。我通过远程桌面连接连接到它。
注意2:我是SharePoint的新手,所以如果有一个明显的"步骤机会是我不知道它是什么。
答案 0 :(得分:1)
最好不要使用作为ASP.NET遗留的SVC文件,而是使用配置激活,例如
<system.serviceModel>
<serviceHostingEnvironment>
<serviceActivations>
<!--This is to replace the standalone svc file whic is the legacy of asp.net web app.-->
<add relativeAddress = "RealWorldServices/RealWorld.svc" service = "Fonlow.Demo.RealWorldService.Service1"/>
</serviceActivations>
</serviceHostingEnvironment>
<services>
<service name="Fonlow.Demo.RealWorldService.Service1" behaviorConfiguration="authBehavior">
<!-- Service Endpoints. A Service may provide multiple endpoints -->
<!-- Not need to define host. Relative -->
<endpoint address="" binding="basicHttpsBinding" contract="Fonlow.Demo.RealWorldService.IService1" bindingConfiguration="httpsBindingConfig">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
因此,您将获得更简单的部署。
有关详细信息,请查看http://www.codeproject.com/Articles/627240/WCF-for-the-Real-World-Not-Hello-World
答案 1 :(得分:1)
如果您在IIS中托管服务,则创建一个应用程序并将SVC文件放在应用程序的根目录(以及Web.config)和bin文件夹中的程序集中。因此,例如,如果应用程序名称(在IIS中)是&#34; MyWCFService&#34;,并且它的物理位置位于C:\ intepub \ wwwroot \ MyWCFService,则.svc文件将进入root - C:\ inetpub \ wwwroot \ MyWCFService \ Service1.svc。
地址为http://servername/MyWCFService\Service1.svc
。
如果您未在IIS中托管服务,则无需使用.svc文件。