0

Now I created a WebApi and set its project url to https://localhost:44332/.

I can access it using url https://localhost:44332/api/test/get. But I also want to use http to access it, just like http://localhost:44332/api/test/get.

enter image description here

How do I configure the WebApi?

1 Answer 1

1

Environment for local machine development can be set in the Properties\launchSettings.json file of the project.

If you launch your project with IISExpress you could setup which ports to use for https:// and http:// like this

"iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:59481",
      "sslPort": 44308
    }
  },

In this case, the application will be available on http://localhost:59481 and with SSL on https://localhost:44308. Please note that both endpoints could not have the same port (even in public web HTTP and HTTPS are on different ports, usually 80 and 443)

You could read more about the setup of the local environment here

Sign up to request clarification or add additional context in comments.

Comments

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.