Error while publishing web app to azure - asp.net

I get this error when i publish my webapp. Any idea why and how can i solve it?
I was able to publish it properly but then i deleted the webapp in azure and then tried to publish it again. Got this error.

Just delete browser cookies.
I created web app (1st time) --> it saved some cookies for authentication
deleted the webapp from azure -->> cookie still saved on browser
Created web app again, cookie did not get updated so there was this error.
Just delete browser cookies and it should solve this error.

Related

Publishing Flutter Web App to Firebase Hosting: recent changes not published

My Codemagic pipeline is configured to fetch sources from my repository, build web and publish it to Firebase hosting.
The build is each time successful, but the changes from my last commit are not there, so I assume that the publishing part somehow not woking properly.
In the logs though everything looks great, my last commit is fetched, and firebase logs say that deploy is complete with the link to the site and all. (see below)
How could I "Debug" this case, any ideas on what is wrong?
you can try following steps to debug such type of issues:
open site in incognito mode to ensure issue not related to browser cache
check Cache-Control and Date response headers for main.dart.js file to ensure you have properly configured cache behaviour in Firebase Hosting
https://firebase.google.com/docs/hosting/manage-cache
https://firebase.google.com/docs/hosting/full-config#headers
I hope it will help

Auth0 Authorization Stops Working When API is Published (.Net Web API / Angular)

I am currently using Auth0 with Loc7 in Angular and an ASP .Net Web API v2.
The project works fine locally. The user can log in using the widget and the API sees the User as authorised with no issue.
When the app is published the API returns 401 unauthorised when a call is made.
There is no issue with Angular app no matter where on the web space it is placed so I do not believe it is an issue with the Allowed Callback URLs in the Auth0 dashboard.
The config works fine locally and there are no major changes when being published except the database connection string.
The database is an exact copy of the local database.
The API MVC Template works fine but does not do anything aside from load and show routes. I have not changed the template since it was generated.
There are no errors on the server.
The API is in a newly created app directory on the server.
Auth0 Dash reports the login from the Angular code successful. The profile is returned with a valid token viewed through the dev console.
Has anyone else had a similar issue? Could this be an issue with how the hosting is set up?
Happy to post more info, I am not really sure what to post it is a fair amount of code.

ASP.Net redirecting to local host after authentication

I just created a webform that is hosted in my Azure subscription. I set it up with authenication via my works Azure directory for authenticating users. In debug this works fine and I am able to login with my work credentials and then view the website via local host.
I have published this to my Azure and it says it is running and working fine. So when I try to connect to the website it continuously redirects me to the localhost resulting in an error.
I have checked the web config.
Here is the google network chain of events when it occurs.
I am really lost as to what is wrong and what I need to do to fix this so any help would be greatly appreciated. I'm sorry I can't offer more but I don't even know what is wrong to begin with or where to look. Is there some setting in Azure that I need to add the website too?
I have solved this issue. Since it was such a pain I will keep this up as I couldn't find any answers on this. It was actually quite simple.
You have two options. The one I did and which worked was changing the publish profile as below:
Add the domain where the authentication is occurring. So if you have your web app hosted by a different azure account that which is authenticating the users, use the one that is authenticating.
This will create two versions of your app on the site one for local host and one for the actual site.
The second option(I have not tried this but it should work) is to go to the Azure account where you are authenticating the users and go to applications and then configure. Change the APP URL from local host to the url you are trying to get to.
Here is an excellent link that explains how to do this clearly.
Click this link for detailed explanation
I also had this issue and took these steps to resolve
navigate to the app registration in AAD
Open the manifest
Change the ReplyUrl to the url of the app (e.g. http://appname.azurewebsites.net)
Then I got the error
Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long.
Next I cleared all cookies from the browser, and this changed the error to just
Bad Request
So I went back to that ReplyUrl and changed it to https://appname.azurewebsites.net/.auth/login/aad/callback and now it appears to work.
Note I also had to make sure I didn't have the site open in any other tabs before it started working
I had this issue when I switched an app from our company Azure over to a customer's Azure. In my case I'd forgotten to update the ida:ClientId, ida:AADInstance and ida:TenantId, which then meant that the value I'd set for ida:PostLogoutRedirectUri was ignored (I think) and instead my app redirected to localhost.
Once I changed those ida values to the values from the app settings and subscriptions settings on our customer's Azure it all worked as expected.
It took a while to track down all the values in Azure portal as they are all called something different, or aren't named at all:
ClientId can be found at Azure Active Directory > App Registrations > YourAppName. It's called 'Application ID' in Azure
Domain can be found on Azure Active Directory > Overview. It's currently in the top left in the format somename.onmicrosoft.com
TenantId this is the Azure AD instance ID, get that from Azure Active Directory > Properties and then it's called 'Directory ID'
I spent a lot of time trying to work out where the localhost port that was being redirected to was in the code, but it simply isn't there as far as I can see, so I have no idea how Azure was choosing what localhost address to redirect to!
You need to set another parameter in configuration that is replyUrl and assign to your web app, other wise it takes the url from which it was originated.
I was able to fix this by changing my Startup.Auth.cs file redirectUri from "https://localhost:44316/" to https://myapp.com/

Blank page when I run or debug MVC application in local machine

I'm working in MVC 5 application, and all was working well. but after time of edits and updates, I get a blank page when I try to run or debug it in my local machine.
the blank page come if I working under local IIS or IIS Express or VS development server, all return a blank page.
The response header of the request is 503 Service Unavailable
Solved:
I find the app_offline.htm file in the directory of my application which cause this behavior...
just write for who may get this later, I don't know how/when this file come there.
It may be because the application pool that contains your application is in stopped status. Restart the app pool for your application in IIS as in screenshot below.

iis 7.5 app pool recycling has irritating behaviour

Now I have one irritating problem. I have Site which includes many web apps on asp.net 2.0 classic app pool. My app works with the next steps:
1) I recieve login form from server, input my credentials and send form.
2) When credentials are correct, my server starts to merge all configuration settings from mashine.config and web.config to one file ApplicationConfiguration.merged.xml which located in app root folder.
3) After that my app sends me page and I continue work with site. That's all.
But.. when I start my app first time after app_pool recycling(after time out or manual recycling) I have refreshing my app immediately after writing ApplicationConfiguration.merged.xml. After that my session is expired and I login again and my app works correctly.
ApplicationConfiguration.merged.xml locates in app root folder. When I switch off writing to this file or locate its to another folder (for example temp folder in app root folder) there all works correctly.
IIS refresh my app with next event:
Application_End
ChangeInGlobalAsax
_shutDownMessage=Overwhelming Change Notification in C:\inetpub\wwwroot\my_app_root_folder
Overwhelming Change Notification in C:\inetpub\wwwroot\my_app_root_folder
Change in GLOBAL.ASAX
HostingEnvironment initiated shutdown
CONFIG change
HostingEnvironment caused shutdown
So as I understand IIS thinks that I have changed important configuration files(web.config of Glabal.asax) and refreshes my app. But I don't use this file for anything - I only write current configuration information here. And why doesn't IIS refresh app everytime when I am logging because I am writting file each time after succesfull login but IIS refresh my app only after firt start.
Can I say IIS to ingnore ApplicationConfiguration.Merged.xml changes? I believe you can help me to understand this curious IIS behaviour. Thank's for your help.

Resources