Created
December 9, 2016 20:13
-
-
Save abelsilva/ac4ae0aeaf90c93adf0dcbaa6dca8cfa to your computer and use it in GitHub Desktop.
swaggerwcf self host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<startup> | |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | |
</startup> | |
<system.serviceModel> | |
<services> | |
<service name="SwaggerWcf.Test.Service.BookStore" behaviorConfiguration="bookStoreBehavior"> | |
<host> | |
<baseAddresses> | |
<add baseAddress="http://localhost:8088/books"/> | |
</baseAddresses> | |
</host> | |
<endpoint address="http://localhost:8088/books" binding="basicHttpBinding" contract="SwaggerWcf.Test.Service.IStore"/> | |
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> | |
</service> | |
<service name="SwaggerWcf.SwaggerWcfEndpoint" behaviorConfiguration="swaggerBehavior"> | |
<endpoint address="http://localhost:8088/api-docs" binding="webHttpBinding" contract="SwaggerWcf.ISwaggerWcfEndpoint" /> | |
</service> | |
</services> | |
<behaviors> | |
<serviceBehaviors> | |
<behavior name="bookStoreBehavior"> | |
<serviceMetadata httpGetEnabled="true"/> | |
</behavior> | |
<behavior name="swaggerBehavior"> | |
<serviceMetadata httpGetEnabled="true"/> | |
</behavior> | |
</serviceBehaviors> | |
</behaviors> | |
</system.serviceModel> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ServiceModel.Web; | |
using SwaggerWcf.Test.Service; | |
namespace SwaggerWcf.Test.Console | |
{ | |
internal class Program | |
{ | |
private static void Main() | |
{ | |
WebServiceHost booksHost = new WebServiceHost(typeof(BookStore)); | |
booksHost.Open(); | |
WebServiceHost swaggerHost = new WebServiceHost(typeof(SwaggerWcfEndpoint)); | |
swaggerHost.Open(); | |
System.Console.WriteLine("Press [ENTER] to terminate"); | |
System.Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment