簡體   English   中英

托管帶有SVC文件的WCF

[英]Hosting a WCF with a SVC file ready

我正在嘗試將SP Web部件部署到新的SP服務器。 我讀到我需要先設置WCF服務,然后才能進行部署。 我具有該Web部件的首次部署中使用的所有文件,並驗證了一些改動,該代碼應該可以在新的SP服務器上重新編譯。

這些文件已經有一個.svc文件,該文件已經過驗證。 我正在嘗試遵循有關托管WCF服務的指南,由於我已經擁有.svc,因此對它們感到有些困惑。 我知道這並不像將其拖放到/ _vti_bin文件夾中那么簡單,那么我該如何進行呢?

注意:我沒有物理訪問服務器。 我正在通過遠程桌面連接連接到它。

注意2:我是SharePoint的新手,所以如果有“明顯的”步驟機會,我將不知道它是什么。

最好不要使用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

如果要在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文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM