1

I want to publish ASP.NET Core WebAPI Project with swagger on IIS. i want to run the Project on local machine with IP Address.

Configuration of My PC is: Visual Studio 2017 Community RC Windows 10 IIS

Please help me.

1
  • Hi did you manage to get this working then in the end? Commented Oct 10, 2017 at 11:54

1 Answer 1

2

Have you tried "this one (learn.microsoft.com)"? It helped for me. Don't forget to configure authentication and access to your site physical path for application pool identity you are going to use.

UPD (reply to comment): In case you're using Swashbuckle.AspNetCore package you can try somethig like this in your ConfigureServices(IServiceCollection services):

// Register the Swagger generator, defining one or more Swagger documents
services.AddSwaggerGen(c =>
{
    var info = new Info
    {
        Title = "My web API",
        Version = "v1.0",
        Contact = new Contact()
        {
            Email = "[email protected]",
            Name = "Denis",
            Url = "https://stackoverflow.com"
        },
        Description = "My API"
    };
    c.SwaggerDoc("v1.0", info);
    var basePath = AppContext.BaseDirectory; // this is not equal to wwwroot folder due to WebHostBuilder settings
    var xmlPath = Path.Combine(basePath, "MyApi.xml");
    c.IncludeXmlComments(xmlPath);
});

And in Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory):

// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();

// Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1.0/swagger.json", "My web API v1.0");
    c.EnableDeepLinking();
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for reply. I have already tried this link its helpful for simple ASP.NET Core project. But my project includes "Swagger" swagger.io. So I need solution for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.