2016-10-04 90 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

尝试使用其他浏览器(或在隐身模式下)进行调试。

说明

这是因为你可能添加了一些说明,检查了它在你的浏览器。然后你添加了更多的描述标签并在你的浏览器上再次检查它,而不是重新加载页面,打开了缓存中的一个。浏览器将在缓存中的浏览器中打开页面,而不是在页面静态时重新加载页面。