.net Framework 4.6.1에서 WCF WEB HTTP를 위한 Help page를 자동으로 생성됩니다.
예를 들어 다음과 같이 "/help"을 붙이면 다음과 같이 나타납니다.
(예: http://localhost:8000/Customers/Help )
Using the WCF Web HTTP Help Page
The WCF WEB HTTP Help page displays a short description for each operation provided that you specify one using the DescriptionAttribute. This attribute takes a string that contains a short description of the operation it is applied to. For example, the following code shows how to use the DescriptionAttribute to provide a short description.
[OperationContract] [WebGet(UriTemplate="/template1", BodyStyle = WebMessageBodyStyle.Bare)] [Description("Description for GET /template1")] SyndicationFeedFormatter GetTemplate1(); |
To turn on the WCF WEB HTTP Help page, you must add an endpoint behavior to your service's endpoints. This can be done in configuration or code. To enable the WCF WEB HTTP Help age in configuration, add an endpoint behavior with a <webHttp>
element, set enableHelp
to true
, and add an endpoint and configure it to use the endpoint behavior. The following configuration code shows how to do this.
<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> |
To enable the WCF Web HTTP Help page in code, add a service endpoint and add a WebHttpBehavior to the endpoint setting EnableHelp
to true
. The following code shows how to do this.
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 }); // ... } |
The help page is XHTML based with mark-up that identifies the different parts of the page. This enables clients to programmatically access the page using XElement or other XLinq APIs.
출처: https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/wcf-web-http-service-help-page
'C# > ASP.net' 카테고리의 다른 글
Mail 발송하기 예제 (System.Net.Mail) (0) | 2018.10.25 |
---|---|
Visual Studio를 이용한 ASP.net 웹 배포:테스트 환경에 배포 (0) | 2018.09.26 |
asp:textbox에 placeholder 입력값 예제 만들기 (0) | 2018.05.08 |
URL중에 http://도메인:PORT 구하기 (0) | 2018.04.27 |
DB Connection 실패시 나오는 에러 (방화벽이 차단했을경우등) SqlException (0x80131904) (0) | 2017.09.28 |
에러: Object cannot be cast form DBNull to other types. (0) | 2017.08.30 |
c# fileupload exists (파일 존재 여부 체크) Image 파일만 체크 (0) | 2017.06.10 |
entity framework에서 top5만 나오게 하기 (0) | 2017.06.09 |
(로그인하지 않으셔도 가능)