swaggerwcf icon indicating copy to clipboard operation
swaggerwcf copied to clipboard

Unclear instuction WebServiceHost / Self Host

Open jtlimson opened this issue 4 years ago • 3 comments

Not an issue but a clarification.

How do you implement self-hosted exactly?

Add an endpoint to your App.config file.

is this in a new file called App.config? I notice that fresh WCF project doesn't have App.config

<services>
  <service name="SwaggerWcf.SwaggerWcfEndpoint">
    <endpoint address="http://localhost/docs" binding="webHttpBinding" contract="SwaggerWcf.ISwaggerWcfEndpoint" />
  </service>
</services>

And create a WebServiceHost

Create a WebServiceHost

var swaggerHost = new WebServiceHost(typeof(SwaggerWcfEndpoint));
swaggerHost.Open();

where do you put this line above?

jtlimson avatar Mar 12 '20 07:03 jtlimson

there is a sample project ./src/SwaggerWcf.Test.Service

justin0522 avatar Mar 15 '20 15:03 justin0522

there is a sample project ./src/SwaggerWcf.Test.Service

Thank you Justin. I already checked and tried the sample project before posting this. but I don't think Self Hosted was implemented on it.

Also in the test project. The core wcf gives error something like.

does not have a Binding with the None MessageVersion.  'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or similar bindings.

I'm not sure if that's a normal behavior.

The api-docs works as expected in swagger though.

jtlimson avatar Mar 16 '20 00:03 jtlimson

I submitted a sample project, I hope this will help you. https://github.com/justin0522/swaggerwcf_issues_201

justin0522 avatar Mar 23 '20 04:03 justin0522