打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Set up IIS 7 to run a secure site locally

I've recently been working on a project where I needed to get a development site running using SSL on IIS 7. If its the first time you've done this it can be a little tricky, but IIS 7 has made it super easy to create self signed certificates. You may also need to be able to run your site on IIS locally instead of using cassini, so that you can still debug. These are some of the steps I took to get it up and running:

If you dont already have IIS installed on your PC, go to Control Panel -> Programs -> Programs and features and select “Turn Windows Features on or off”. Select Internet Information Services. Make sure ASP.NET is selected under World Wide Web Services -> Application Development Features.

Go to Control Panel -> Systems and Security -> Administrative Tools -> Internet Information Services (IIS) Manager.

Select your Computer Name on the left under Connections. Now double click Server Certifcates under IIS group.

Select Create Self-Signed Certificate from the actions panel. Enter a name for your certificate. A new certificate should be added to the list with the name you just gave it.

Select a site in the tree view and click Bindings... in the Actions pane. This brings up the bindings editor that lets you create, edit, and delete bindings for your Web site. Click Add... to add your new SSL binding to the site. Select Bindings from Actions panel. Select Add and then select https for type and select the cerificate you just created for SSL certificate. Select OK.

The web site should now have 2 bindings, one for *.80 (http) and one for *.443 (https).

We need to go back to Visual Studio, right-click the Secure Web Site Project and select Properties. Now select the Web tab. For Servers select to use Local IIS Web Server. Set the Project Url to be https://localhost (or whatever you have named your website to be in IIS)

Some browsers will display an error page because the self-signed certificate was issued by your computer, not a trusted Certificate Authority (CA). If you just click "Continue to this website", you will be redirected as normal.

Enabling 32 bit applications

I have also come across this little curveball before:

System.BadImageFormatException: Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format.

or

System.BadImageFormatException: is not a valid Win32 application

If you have recently deployed your asp.net application and it used to run perfectly, and then all of a sudden when running in IIS7 you get the above error, you might need to enable 32 bit applications in your application pool.

Basically, go into your IIS 7 manager console, find the application pool your app is running in, right-click on it, go to Advanced Settings, and change the Enable 32-bit Applications setting to true:

Tada! Hopefully everything should be running again!

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
IIS实现HTTPS的主机名绑定
IIS Express 使用详细说明
How to Create a Self Signed Certificate in IIS 7
IIS实现服务器反向代理用法介绍
Exchange 2010 PKI configuration Guide
Integrating Windows Workflow Foundation and Windows Communication Foundation (转于 MSDN)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服