托管一个准备好SVC文件的WCF
本文关键字:SVC 准备好 文件 WCF 一个 | 更新日期: 2023-09-27 18:17:50
我正在尝试将SP web部件部署到新的SP服务器。我读到我需要先设置一个WCF服务,然后才能部署它。我有web部件第一次部署时使用的所有文件,并验证了这一点,经过几行修改,代码应该可以在新的SP服务器上重新编译。
这些文件已经有一个.svc文件,它被验证是正确的。我正试图遵循托管WCF服务的指南,因为我已经拥有。svc,所以我对它们有点失落。我知道这并不像把它放在/_vti_bin文件夹中那么简单,那么我该如何继续呢?
注意:我没有物理访问服务器。我正在通过远程桌面连接连接到它。
注意2:我是SharePoint的新手,所以如果有一个"明显"的步骤,我可能不知道它是什么。
如果您在IIS中托管服务,那么创建一个应用程序,并将SVC文件放在应用程序的根目录中(以及Web.config),并将程序集放在bin文件夹中。因此,例如,如果应用程序名称(在IIS中)是"MyWCFService",它的物理位置是在C:'intepub'wwwroot'MyWCFService,那么。svc文件将进入根目录C:'inetpub'wwwroot'MyWCFService'Service1.svc。
地址为http://servername/MyWCFService'Service1.svc
。
如果您不在IIS中托管服务,则不需要.svc文件。
最好不要使用ASP遗留下来的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