How to test SSL switching using VS2010 on Win7 - visual-studio

I developed a large web application with VS2008 installed on an old Win2k3 server. I now have Visual Studio 2010 installed on Win7 Pro and work on the application fine.
Parts of my web application need to switch into and out of SSL which they did on the Win2k3 server using the IIS tool that creates a private SSL cert.
However I now need to make changes to those parts and now need to be able to test it on the VS2010 internal web server as I no longer have a dev web server like I used to. Is there any way I can do this or is it definitely a no no?

Please take a look here. It is mentioned:
This sample [some sample using HTTPS]
only works when hosted on IIS and
cannot work on Cassini – Visual Studio
Development Server because Cassini
does not support HTTPS.
As this sample is related to .Net Framework 4, I assume that Visual Studio 2010 does not support SSL.
EDIT: The good news is that you can enable SSL for IIS 7.0 (and above). You can find detailed instructions here.
When are done you should be able to access your website over SSL, but browsers will display a warning that says that your certificate is not trusted. However, this can be easily solved in the following way:
1) The common name (CN) for the self-signed certificate that you create for the website should match the computer name that runs IIS and you should access the site using the computer name (https://computerName/ not https://localhost/ or https://IP/)
2) Export the certificate from IIS and import it in the browsers certificate stores. For Internet Explorer the certificate must be added to Windows Certificate Store at Local Computer / Trusted Root Certification Authorities (use Windows Management Console). For other browsers, because they use custom certificate store, the certificate must be imported in their specific location. For example, in case of Firefox to import a certificate go to Tools->Option->Advanced->Encryption->View Certificates->Authorities->Import.

With the release of VS2010SP1 & IIS Express you can now to debug code that uses with https/SSL without having to use a FULL IIS server.

Related

Is it possible to debug a .NET application that is deployed to IIS on my local machine?

I have incorporated Azure authentication in to a .NET application on my local development machine. When I debug/run the application in Visual Studio the app runs just fine.
I have deployed the application to IIS on my local development machine and have configured a new site binding of type HTTPS which uses an SSL certificate that I have created locally and added to my "Trusted Root Certification Authorities" store. When I try to browse the application through IIS, I get a generic error message that is generated by the Application_Error method in my global.asax.cs file.
Is it possible for me to use a debugger to "step through" code that has been actually deployed in IIS? I think that I have found MSDN documentation that describes doing this for a .NET Core application (https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-2.1) but I my app is written in .NET 4.8 so I don't think it applies for me.
To debug an ASP.NET application that has been deployed to IIS, install and run the remote tools on the computer where you deployed your app, and then attach to your running app from Visual Studio.
For more information about "Remote Debug ASP.NET on a Remote IIS Computer", you can refer to this link.

Certificate is not trusted. Application's installer sometimes works correctly and others fails

I have an application in a test environment and when I install it in my computer all work correctly, but when others users installs it some of them works and others fails. When it fails, it displays this error: customized functionality in this application will not work because the certificate used to sign the deployment manifest for appname o its locations is not trusted. Contact your administrators for further assistance.
In addition, I created a test certificate, using visual studio 2015, to sing the application. The application is an add-in using VSTO.
The app is downloaded from a web server into my company, also it uses two web services.
Here is a photo of the error
Get a proper certificate or install the certificate you used onto the computers that you want this app to trust. The whole concept of having to sign the cert is to prevent accidental installations of untrusted applications. In order for that to work the machines you're installing to need to first trust the cert.
You will need a Code Signing certificate and sign the Click-Once package using that cert. You may still need to distribute the trusted cert to the machines somehow (depending on how those are setup).

Visual Studio Browser Link not working in Firefox

I'm using Visual Studio 2015 and Browser Link doesn't work with Firefox.
IE and Chrome work perfectly with Browser Link.
Just got a new machine, but that didn't help either.
I tried the prerequisites mentioned in the browserlink dashboard (for static files, enable debugging) and I use IIS express, so .NET 4.0 is there.
Are there any more settings needed in Firefox?
In the network view, I just don't receive a response from the server, 0 bytes transferred.
Network trace:
Found it, the main website was running on 44300, browserlink seems to run on 44399 (although that port isn't visible in IIS express)
Browse to https://localhost:44399 gave me the Firefox "This Connection is Untrusted" screen, where I needed to trust("confirm security exception") the self signed IIS certificate (just like what I had done on the https://localhost:44300 site)
So it seems Firefox remembers trusted certificates per port number, not per DNS/IP/Name like IE and Chrome seem to do.
Now the browserlink is working and downloading the files.
I don't have IIS running locally, but ran into a similar problem running the app locally with Visual Studio 2019.
The suggestion by Erik fixed the problem for me as well. Browsing to https://localhost:44399/ and accepting the certificate worked in Firefox Developer.
Some more details from Microsoft regarding self-signed certificates:
https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/handling-url-binding-failures-in-iis-express

Does Windows Identity Foundation (WIF) Require IIS? (Rather than Development Server)

I need to know if developing a Windows Identity Foundation (WIF) solution requires IIS installed. I would like to be able do develop a WIF solution using the built-in Visual Studio Development Server (I heard it is called Cassini) if possible.
All of the samples I've downloaded assume that IIS is up and running on the local system.
This blog, Securing WCF Services with Custom WIF STS: A Step-By-Step guide, lists requirements for a WIF example and has IIS as one of the requirements.
I've added the images to allow you to follow easily with the steps.
Pre-requisites:
Visual studio 2010
The development machine has IIS installed (I use Windows 2008 R2)
Windows Identity Foundation (WIF): download it from http://www.microsoft.com/download/en/details.aspx?id=17331
Windows Identity Foundation SDK: download it from : http://www.microsoft.com/download/en/details.aspx?id=4451
I also have noted another StackOverflow posting indicating that IIS Express can be used. I have not yet fully investigated IIS Express, however this doesn't answer my basic question.
I can't seem to find any other references anywhere else about this topic. I'd appreciate knowing if anyone has been able to develop a WIF solution implementing a Security Token Service using the standard Visual Studio Development Server alone. Otherwise, I will look into using IIS Express. I am unable to install and use IIS (non-Express) on my system as I don't have local admin access.
Thank you.
Before .NET 4.5 WIF was a separate package and an additional installation step.
.NET 4.5 makes several important changes and moves WIF into the .NET base class libraries. The move enables WIF to be used by any application regardless of host. There's enough changes that if you are starting new, I recommend upgrading to .NET 4.5 to avoid porting in the future and because the integration does make things easier.
I'm currently running Visual Studio 2012 and testing WIF code in IIS Express and ServiceHost without issues.
I don't have local admin access
This is a big problem. Not having local admin for WIF development may not work. You will need elevated privileges to install tools and test applications.
Regardless of version, you shouldn't have any issues running apps with WIF outside IIS. The limitations are more around running SSL. Have you tried? Did you get any errors?
As #Eugenio states, one of the issues is around SSL. The other problem is that Cassini uses localhost which means that you need to have a valid localhost certificate if you are thinking of adding this application to something like ADFS. (as opposed to having a certificate for the actual machine name).
Also, to do WIF development, you have to run VS in Admin mode.

Debug website that requires client certificates in Visual Studio 2010

I have a website that is hosted using IIS7 when deployed, but we are seeing strange behavior with a web service we use that requires a client certificate. So what I'd like to do is debug our website locally to step through the code and take a closer look at the issue.
The problem is that I cannot figure out how to have the website accept client certificates when I'm running it locally (debugging it). If I just run it locally and perform an operation on the website that uses my client cert, it is clearly not pulling it from the browser because I'm getting "m_safeCertContext is an invalid handle" errors.
Is there a way to have the website accept client certificates when running locally? I have IIS7 installed on the same machine that has Visual Studio 2010 Professional installed, and the OS is Windows 7.
Thanks.

Resources