0

We have one ASP.Net Pure MVC application (.Net MVC and jQuery). But due to traffic increasing clients wanted to move on HADR (High Availability Disaster Recovery) using Microsoft Azure Web App. So we have deployed the same on 2 different Web App by going through the link https://codewithshadman.com/machine-key-generator/ and also link Adding machineKey to web.config on web-farm sites

Post following above links, we are using the same Machine Key for these 2 Web Apps. But when we hit the HADR URL we landed to Login Page but when hit on Login Button post entered Username and password, under the web development tool in Google Chrome, we see the error 'Internal Server Error (500)'.

So anyone have idea how to setup the same for Azure Web App?

Mihir Shah
  • 948
  • 10
  • 17
  • Is it asp.net core or the old asp.net 4.x? https://learn.microsoft.com/en-us/aspnet/core/fundamentals/choose-aspnet-framework?view=aspnetcore-3.1 – krishg Aug 24 '20 at 14:03
  • @KrishnenduGhosh-MSFT, It is .Net Framework 4.5. Yes it is ASP.Net 4.x – Mihir Shah Aug 25 '20 at 14:59
  • What is the exception you are seeing in error log? 500 is too generic to know what is going wrong. Also, I assume along with sharing machine key you also have setup out of proc state store since your app is now distributed? https://learn.microsoft.com/en-us/previous-versions/aspnet/ms178586(v=vs.100) – krishg Aug 25 '20 at 15:24
  • @KrishnenduGhosh-MSFT, exact error is: "The required anti-forgery cookie "__RequestVerificationToken" is not present." We have the SQL Server Session which is out of proc state, correct? OR do I need to set somewhere "Out of Proc State"? – Mihir Shah Aug 26 '20 at 06:51
  • SQL is fine. It's out of proc. I will check on the error part. – krishg Aug 26 '20 at 06:58
  • @KrishnenduGhosh-MSFT, do i need to add anything in web.config file in this case like, ? – Mihir Shah Aug 26 '20 at 07:00
  • yes, you need to configure SessionState in web.config. https://learn.microsoft.com/en-us/troubleshoot/aspnet/configure-sql-store-session-state – krishg Aug 26 '20 at 07:30
  • @KrishnenduGhosh-MSFT, Is there any way to access the Machine Key at MVC Controller? I am not asking reading the Machine Key from configuration. Reason from asking this, I doubt Azure is not using the Machine Key which we have configured through the Web.Config file so like to cross check by accessing the Machine Key at Runtime and wanted to compare with configured one. – Mihir Shah Aug 26 '20 at 13:39
  • Ahh I see. No you cannot read the machine key used by the app from code. But you seem to be right that the machine key from web.config is not respected. So can you try overriding at app start up as mentioned here https://stackoverflow.com/a/29765371/13791953 There are many upvotes in that answer. – krishg Aug 26 '20 at 13:52
  • @KrishnenduGhosh-MSFT, Currently I am doing exactly the same way mentioned in that Post. Either way, it is throwing the same error. Going through Web.config way OR Global.asax way. – Mihir Shah Aug 26 '20 at 13:58
  • Regarding the session state part of the earlier comment, were you able to set it up correctly with SQL? – krishg Aug 26 '20 at 14:05
  • @KrishnenduGhosh-MSFT, Yes. I used this: , and I have two tables in this database 1.ASPStateTempApplications and 2. ASPStateTempSessions – Mihir Shah Aug 26 '20 at 14:15

0 Answers0