2016-10-04 88 views
2

我目前在WPF應用程序中託管幾個Web服務。我也啓用了自動幫助頁面來簡化服務文檔。每個OperationContract都裝有一個Description屬性,其中包含有關該方法的信息。缺少基於任務的WCF服務的幫助描述

但是,無論何時我查看我的幫助頁面,我都會意識到只有返回類型爲void的方法才能在此處正確顯示其Description屬性。返回的方法TaskTask<t>只會說「Service at localhost:XXXXX/ServiceEndpoint」。

由於此模式用於IPC,因此我非常依賴異步操作合同,因此其中大多數將返回TaskTask<t>。有沒有辦法解決這個問題,以便幫助正確顯示?

enter image description here

namespace App 
{ 
    [ServiceContract] 
    public interface IMainService 
    { 
     [OperationContract] 
     [WebGet(UriTemplate = "visibility")] 
     [Description("Gets the main window visibility.")] 
     Task<bool> GetVisibilityAsync(); 

     [OperationContract] 
     [WebInvoke(UriTemplate = "visibility", Method = "PUT")] 
     [Description("Sets the main window visibility.")] 
     Task SetVisibilityAsync(bool isVisible); 

     [OperationContract] 
     [WebInvoke(UriTemplate = "menu", Method = "PUT")] 
     [Description("Navigates to the main menu.")] 
     void NavigateToMainMenu(); 

     [OperationContract] 
     [WebInvoke(UriTemplate = "shutdown", Method = "PUT")] 
     [Description("Requests the application to shutdown.")] 
     void RequestApplicationShutdown(); 
    } 
} 

這裏是我的app.config

<system.web> 
    <compilation debug="false" targetFramework="4.5" /> 
    </system.web> 

    <system.serviceModel> 
    <services> 

     <service name="App.MainService" behaviorConfiguration="rpcServiceBehavior"> 
     <endpoint binding="webHttpBinding" 
        contract="App.IMainService" 
        behaviorConfiguration="webHttpBehavior" 
        name="RpcEndpoint"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:25565/main"/> 
      </baseAddresses> 
     </host> 
     </service> 

    </services> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="rpcServiceBehavior" > 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
     <behavior name="webHttpBehavior"> 
      <webHttp helpEnabled="true" automaticFormatSelectionEnabled="true"/> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    </system.serviceModel> 


    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

回答

0

嘗試使用其他瀏覽器(或在隱身模式下)進行調試。

說明

這是因爲你可能添加了一些說明,檢查了它在你的瀏覽器。然後你添加了更多的描述標籤並在你的瀏覽器上再次檢查它,而不是重新加載頁面,打開了緩存中的一個。瀏覽器將在緩存中的瀏覽器中打開頁面,而不是在頁面靜態時重新加載頁面。