VS 2019 - run project as application inside web site - iis

I am trying to find a way to test something specific. I am having an issue with a web application to where it redirects to the website and not the web application after being published and deployed to IIS. So to debug the issue i need to set up Visual Studio to have the same structure as IIS. I am integrating with AzureAD and after the login to Azure redirects to the web app, the web app then redirects again. So after AzureAD login, i am at the right URL, but then for some reason get redirected again. So i need to debug.
Example of the issue:
Go to website: https://myurl.com/webApp1/
push button to log in to AzureAD.
redirects to MS Azure login screen.
after successful login to Azure, redirects back to site: https://myurl.com/webApp1/
web app then redirects to website with no app name: https://myurl.com/
Running the site through VS 2019, it is always: https://localhost/
so the issue doesn't happen because it is ok if the site redirects to https://localhost/ at any point.
My question is if there is a way to set up VS to match the structure of IIS? Thank you for any help.

You can debug a Visual Studio application that has been deployed on a different computer(App Service, VM, etc.) using Visual Studio remote debugger.
There are various methods with which you can do that, and it depends on the Tech stack you are using. Pls visit the link above and follow tutorial as appropriate.
Place your breakpoints in the Login flow, and you will be able to debug deployed code and find out the issue.

Related

Web Deploy unable to validate connection

I am trying to learn how to setup Web Deploy functionality on both sides Server and host/client computer. Created a Windows Server 2012 Web Server in Hyper-V and able to access default web page in host/client computer. On server installed Web Maintenance Service, Web Deploy 3.5 and performed all the required steps e.g. "Configure Web Deploy Publishing" and added Administrator to IIS Manager Permission for the website in IIS. I disabled Firewall totally to make it work for the first time.
On client computer I created a dummy MVC Application in Visual Studio and trying to create publish profile for this app. As soon as I hit the Validate Connection I got the option to receive and save the security certificate from server but after that in gives me following warning (snapshot):
Tried doing all the steps all over but no luck.
I am open to all feedback. Thanks in advance.
Found the solution. Instead of adding publish information manually, I am suppose to use publishsetting file generated in server through "Configure Web Deploy Publishing" feature of IIS. Server address ends with file name which ends with .axd

IIS Server and Azure AD

I am building a Office 365 application using ASP.net Visual studio 2015 Enterprise. When I run the application in visual studio using IIS Express it run fine everything works. I am able to authenticate with Azure AD and be routed back to my start page. However, when I deploy it to the IIS SERVER, I am able to authenticate but after authenticating I am routed back to a WHITE screen.
FIREWALL is off
I DO NOT WANT TO HOST IN THE CLOUD!!
I tried using Fiddler but that didn't help me that much. Have anyone ever ran into this problem or similar? Were you able to get around it without hosting in the cloud?
I had this same problem - it worked fine in IIS Express, but in IIS I would get a 400-Bad Request (header too large) error and the page would just spin. To fix this:
Make sure your app login and your reply URL are the same in Azure. Make sure the PostLogoutRedirectUri in your app matches as well.
That URL in step 1 should not be a page! This is what got me I think. I had https://localhost/testdirectory/default.aspx when I should have only had https://localhost/testdirectory/. Once all 3 places matched, things started working in IIS as well.
You probably know this but make sure you're using HTTPS, not HTTP.

Hosting .Net Core application with Azure Active Directory authentication on IIS

I am wanting to host a .Net Core app on IIS that uses authentication through Azure Active Directory. Right now I have the basic site setup that comes from completing the new project wizard in VS and it works great locally. However, when I deploy the project to IIS and try to open the page it seems to get stuck in an endless loop redirecting to the Microsoft login page that ultimately ends up in a:
Bad Request - Request Too Long
HTTP Error 400. The size of the request headers is too long.
Any idea what I am missing?
Ensure that you have proper Reply URLs set up. Go here:
And add replay url:

Azure WebApp PageMethod fails

I have created a Azure Web App and published my application from Visual Studio and I can access the website as expected. However, the aspx web pages in the website use calls to PageMethods using the asp.ScriptManager. All works fine if I host through IIS on a web server but any calls when hosted as an Azure Web App returns "Object doesn't support property or method....".
After some more investigation, I get 'Sys' is undefined and checking the network monitor, WebResource.axd and ScriptResource.axd return a 404. Odd
Does Azure not support this? Or am I missing some configuration?
Found the solution. I was running the WebApp in Classic mode. Switched to Integrated mode and the script files are delivered.

Web Deploy from Visual Studio 2012 to a remote IIS 8 server

I have a remote Windows 2012 server running IIS 8 from which I am hosting a web application. My local development box is running Visual Studio 2012. Currently I am publishing my app as a web deployment package (.zip), RDP'ing to the production server, copy + pasting to a folder and deploying the application from within IIS. My question is, what changes do I need to make to deploy directly to IIS from Visual Studio 2012 using the web deploy option?
I have tried to follow this guide but it refers to a service URL which I must obtain from my hosting company. I don't have a hosting company, my server is co-located.
I am presented with the following options:
Is the username and password the one I use for the RDP account? I already have Web Deploy 3.0 installed on IIS do I need to enable further settings?
OK I found the solution but it took me a whole day to get it working! Basically the steps are as follows. This is very sketchy but see the detailed guides below which helped me.
Enable the IIS Web Management role feature.
Install Web Deploy 3.0 (or higher). Make sure to customise the install to include the handlers (See notes below). If you're not presented with this option go to add/remove programs, find webdeploy, right click and select "change" option.
In IIS click on the server node and find the "Management Service" icon. Enable remote access and configure a dedicated IIS User for remote deployment (These will be the credentials that will go in the user name and password boxes).
At the site level in IIS assign this user to manage the website.
Make sure port 8172 is open on the web server (you can check this port here).
Try reconnecting from Visual Studio. There was some trial and error here for me but the error messages do link to a MS guide for decoding :)
Even after connecting successfully I had to wrangle with permissions, so my IIS user had sufficient privileges to create the app pool, directories and general file management jobs.
The following links really helped!
Configuring the handler on the web server:
http://www.iis.net/learn/publish/using-web-deploy/configure-the-web-deployment-handler
Connecting via Visual Studio:
http://msdn.microsoft.com/en-us/library/dd465337(v=vs.110).aspx
NOTES:
To ensure the handler is running, login into your IIS server and point your browser to the following URL.
https://<servername>:8172/MsDeploy.axd
F12 to open up the dev tools to see the HTTP response. Also MsDeploy also creates IIS logs in inetpub/logs which should give you some clue if you're having connectivity problems.
I had the same problem and this post was very useful to help me solve the issue. I had anyhow serious troubles while trying to install Web Deploy on my Windows Server 2012. The installation of Web Deploy 3.0 was giving me several errors and it couldn't be completed.
I tried to solve the problem installing "Microsoft Web Platform Installer 5.0" from http://www.microsoft.com/web/downloads/platform.aspx but it didn't solve it.
I thought it was due to Firewall Settings, Authorizations issues, Users without permissions or something like that. Finally I found out it wasn't due to any of the mentioned reasons.
I found the most simple solution and I hope it will help other users too: it was enough to download Web Deploy 3.5 installation directly from Microsoft Website:
http://www.microsoft.com/en-us/download/details.aspx?id=39277
This may sound banal but it solved it. I was able to install "Web Management Service" but not the second needed IIS service "Web Deployment Agent Service".

Resources