2011-12-23 80 views

回答

0

没有可用的确切的页面,但你可以使用用Visual Studio 2010提供的WCF可用性。

使用WCFTestClient。

  1. 打开Visual Studio 2010的命令提示符下
  2. 类型WcfTestClient(它打开的窗口)
  3. 添加服务选项
  4. 添加网址像http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/mex 您可以与您的托管服务取代。

希望得到这个帮助。

+0

我收到以下错误 无法添加服务。服务元数据可能无法访问。确保您的服务正在运行并展示元数据。 – Samir 2011-12-24 08:40:57

0

(我逐字转述这些链接)

  1. 添加描述属性,方法,并可能WebGet,以及像:

    [OperationContract] 
    [WebGet(UriTemplate="/template1", BodyStyle = WebMessageBodyStyle.Bare)] 
    [Description("Description for GET /template1")] 
    SyndicationFeedFormatter GetTemplate1(); 
    
  2. 暴露通过web.config终点......

    <endpointBehaviors> 
        <behavior name="RESTEndpointBehavior"> 
         <webHttp enableHelp="true"/> 
        </behavior> 
    </endpointBehaviors> 
    <!-- ... --> 
    <services> 
        <service behaviorConfiguration="RESTWebServiceBehavior" name="RESTWebService">  <endpoint address="" kind="webHttpEndpoint" behaviorConfiguration="RESTEndpointBehavior" contract="IHello" /> 
    
         <!-- ... --> 
        </service> 
    </services> 
    
  3. ...或代码

    using (WebServiceHost host = new WebServiceHost(typeof(Service), new Uri("http://localhost:8000/Customers"))) 
    { 
        host.AddServiceEndpoint(typeof(ICustomerCollection), new WebHttpBinding(), "");    
        host.Description.Endpoints[0].Behaviors.Add(new WebHttpBehavior { EnableHelp = true }); 
        // ... 
    }