Swagger UI not accessible following WebDeploy - swagger

Been struggling with this for a bit and looking for some advice.
I have .NET 5.0 api web application with swagger ui that works locally (https://localhost:5001/swagger/index.html), but when I deploy via WebDeploy it says it's successful but I cannot access the web page (404)
I was expecting to be able to access it at https://mysite/swagger/index.html
I have an accompanying project that uses the api that I am deploying with WebDeploy with virtually the same configuration and it works ok.
The API is up and running, I just can't get to the web interface.

Related

.NET 5.0 Web API project returning 404 when {domain}/swagger/index.html is requested after deployment

I am new to .NET Core 5.0, currently working in a project where we have developed a multi-project Web API solution. For each Web API project, there is a startup.cs file, inside it we have the Swagger code like UseSwagger(...), UseSwaggerUI(....).
Now the issue is, Swagger is working fine in local (i.e., when I run the API on the local machine and request the URL http://localhost:5000/userService/swagger/index.html, it's showing up the API URLs etc). But when the API is deployed in AWS and a request is made to https://{domain}/userService/swagger/index.html, it returns 404.
Domain -: (provided by AWS)
Deployment is done through a Jenkins pipeline which internally calls the Dockerfile (each API project has a Dockerfile) to build and publish the .NET Core project.
Am I missing something?

Deploying MVC file system publish on IIS7

I have created an MVC application in Visual Studio 2013 and I now wish to deploy this on the IIS of the server so that all employees from within the company will be able to access it via their windows login credentials.
When I run this in localhost via Visual Studio debug it works as expected but I have been trying unsuccessfully to deploy this to a network server and I am unsure of the process and would be grateful for some clarification.
I chose a file system publish from the publish options but I am unsure as to how to get this accessible as an application. I have tried adding the files via the new website wizard and tried the url of 'holidays/' which I had entered but without success. I then tried to add the same virtual directory location as an application from within this website but again this was unsuccessful.
I use Web Deploy with VS. Your target server needs to also have Web Deploy:
Installing and Configuring Web Deploy on IIS 7
Once your target server is ready, you can deploy from VS. Here's a guide on doing that (you can jump right to "Publish to IIS" section if you like):
ASP.NET Web Deployment using Visual Studio
With Web Deploy, you can choose to publish directly or use a deployment package. Once you are happy the publishing works locally, you have a level of confidence your publishing will work in your Live environment.
I would suggest that before you publish direct to a live environment, that you test publish it to your local machine or a test environment that has the same IIS version, and .NET Framework installed.

Ngrok + IIS Express and Windows Authentication

Im trying to expose a web application I have developed in ASP.NET MVC 5 through ngrok and Im having no luck with the Windows Authentication. My plan was to test the app using other VMs with IE8 (insert rage here) and a few mobile devices connecting through ngrok.
My setup details are as follows.
VM with Server 2008 (Domain Controller), Visual Studio 2013, SQL etc and development tools
Domain XYZ setup in VM with test users
The Web App is running by F5'ing VS in IIS Express and uses Windows Authentication. IIS express is configured to support Windows Authentication.
I have configured ngrok bindings in the applicationhost config file and also run the netsh command "netsh http add urlacl url=URLPLUSPORT user=everyone"
I can access and use/debug the app fine on the VM using localhost, this has always worked. However, when I run ngrok and then access the app from outside the VM I get the login credential prompt (was expecting this). I enter the correct user/password and I still get 401 Unauthorised and cannot access the app.
Can anyone help? Do I need any extra configuration to allow the authentication to pass through? Is this even possible?
I am pretty much stumped right now and the ngrok site is down although I cant imagine there is much documentation on this scenario :(
Thanks for your help

FederationException ID3206 in MVC application deployed to AWS EC2 instance

I have an MVC5 EF6 application configured to authenticate using organizational authentication (Azure AD) which works fine when running in IIS Express on my development PC. It was developed using Visual Studio 2013.
I have now deployed the application to an AWS EC2 instance using the Cloud Formation wizard in the AWS Visual Studio toolkit. I have also reconfigured the application entry in the Azure AD to run against the deployed version instead of the development version.
When the application is run by navigating to the ec2 instance from a browser, the user is presented with the Microsoft authentication page, so I know the deployed app is running. After successful authentication I get the following error:
ID3206: A SignInResponse message may only redirect within the current web application: '/' is not allowed.
I have tried all the potential solutions I can find from SO and other forums concerning this issue. These include several different ways of ensuring a backslash is at the end of a URL. However, none of these approaches fixes my issue.
My issue seems to be slightly different in that the error states that:
application: '/' is not allowed
All other similar references I've seen have something like:
application: '/appname' is not allowed
My application does not have this issue in development using IIS Express.
Can anyone offer any potential solutions or avenues to research concerning this?
The redirect error only occurs using the Amazon Cloud Formation tool (inside the AWS Explorer in VisualStudio) to deploy to AWS. If Amazon's Elastic Beanstalk tool is used instead to reply to AWS, the redirect after successful authentication works fine.
Deploying to Azure using VisualStudio results in a successful redirect too.
So, although this is not a definitive answer as to why the Cloud Formation deployment causes the redirect error, using Amazon Elastic Beanstalk instead will redirect correctly.

MVC4 WebSite 404 Error on IIS7

Set-up
I have a website built in Visual Studio 2012 using MVC 4 and .NET framework 4.5.
It is being hosted on a Windows 2008 and running IIS7.
I am using a VS2012 "Web Deploy Package" to deploy to the server. I manually copy this to the server and run the install using the web deploy cmd script option /T and then /Y. It all installs fine to the Test folder.
On the Test website in IIS the application pool is pointing to the DefaultAppPool which is set for integrated and pointing to the .Net Framework v4.0.30319
I have created a new Web Site in IIS for the application called Test and defaulted the bindings for port 80 and stopped the default web site that is in IIS.
I've created a new foldeer called Test under wwwroot which is where the Web Deploy script is set to point to, when I created the script I add "Test" as the Site/Application
When I have created the web deploy package on my local machine I am manually copying the zip file and other deploy files (cmd,*.xml) to the remote server
I have run %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i on the server and installed .net 4.5 framework and MVC framework components I could see in the Web Platform installer.
Problem
This website was previously being hosted on Windows Azure and have been able to direct publish to Azure and everything runs fine and when I go to any page it displays as expected.But on the new web server I get a 404 when I go to any page.
Everything seems to be installed as far as I can see on the web server. I was able to stop my website and re-start the default web site and add an index.htm file and that displays fine.
It almost seems like something in the MVC pipeline is not initialising. I'm using the standard Home controller with Index action that comes as part of the VS20102 MVC template as a test and that returns me a 404 when I go to /Home.
I've also tried other endpoints (I have WEB api rest endpoints off /API/* and these are returning 404 errors).
I'm just wondering if there is some basic set-up I've missed. It almost seems like some service is not running correctly and picking up the MVC website.

Resources