Giter Site home page Giter Site logo

asp.net-core-1.1-development-with-ssl's Introduction

ASP.NET-CORE-1.1-Development-with-SSL-Visual Studio 2017

Debugging in IIS Express

Create New ASP>NET Core Web Application(.NET Core). Select Web Application and be sure that you have "ASP.NET Core 1.1" selected in the dropdown and Individual User Accounts.

Right click your project and select properties. select Debug in the left menu.

Enable SSL and save.

Remember the URL, in this case:

https://localhost:44336/

See in your launchSettings.json that the sslPort is changed from 0 to 44336

Et voilà....You're Done.

Debugging in Project

Create certificate: Right click your project and select properties.

Select Signing in the left menu.

Select the box [] "Sign the assembly" and in the dropdown select new.

Give your key a name and password.

In your solution you will see the certificate file pfx.

####Add dependency in Nuget package Manager. ``` Microsoft.AspNetCore.Server.Kestrel.Https ```

Open program.cs and ad the following code so that it looks like this:

    public class Program
    {
        public static void Main(string[] args)
        {
            var cert = new X509Certificate2("IdentityServer4TestCertificate.pfx", "123456789");

            var host = new WebHostBuilder()
                .UseKestrel(cfg => cfg.UseHttps(cert))
                .UseUrls("https://localhost:5011")
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .UseApplicationInsights()
                .Build();

            host.Run();
        }
    }

I put the URL as: https://localhost:5011 you can choose whatever you like. Now change your debug mode into the project. and F5 or ctrl F5.

Go to your browser and enter the URL: ``` https://localhost:5011 ```

select ADVANCED and then "Proceed to localhost (unsafe)".

And It's running in Https now.

asp.net-core-1.1-development-with-ssl's People

Contributors

petervanhemert avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.