How do you force IIS Express to default to https URL?

I have enabled SSL in my MVC website for IIS Express by setting 'Enable SSL' in the project properties to true. So now I can access my site while debugging over http as well as https (IIS Express's default port 44300). However I'd like to force the default URL to be the SSL one. https://localhost:44300/. Whenever I run the app. from VS it always loads the http URL.

If I try and update the project URL (right click on the project -> click on properties -> navigate to the web tab -> set project URL to https://localhost:44300/) to https, the website fails to load. I just get a 'Page could not be loaded' error in the browser. However if I explicitly add a binding for https to port 44300 in my local IIS instance using IIS Management service it seems to work. I don't think I should have to touch local IIS in any way though.

Am I missing something here? Could someone help me figure this out?


Figured it out. This tutorial is perfect and walks you through the whole process http://www.lansweeper.com/kb/54/How-to-configure-SSL-in-IIS-Express.html


Sudeep,

If you are using the IIS on your machine (or on your server) you could create a rewrite rule that would intercept any http requests and will replace the http protocol with https.

Here is a link to get you started: http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

As for IIS Express, it has its advantages of using it, but on the other side it is missing advanced functionality like URL Rewrite (check this link: http://weblogs.asp.net/scottgu/introducing-iis-express).

Best Regards, Daniel D.

链接地址: http://www.djcxy.com/p/68730.html

上一篇: 通过锁定tfs进行冲突,iisexpress applicationhost.config编辑了asp经典

下一篇: 如何强制IIS Express默认为https URL?