Website uses old CSHTML files after already change it and deploy

Zhang, Cen@DTSC 0 Reputation points
2023-06-15T21:05:24.4033333+00:00

contact: daniel.nadayag

email: ******@dtsc.ca.gov

Work number: +1 916-322-0279


Website uses old CSHTML files after already change it and deploy

We are using #technology# in Azure DevOps to deploy an ASP.NET #version# MVC web application to an on-premises Windows server 2019 data center running IIS 10.0. We’ve previously deployed this same application using the same pipeline to an on-premises Windows 2012 server running IIS 7.5 without any issues. However, since migrating to the new server, changes to the CSHTML files are not reflected in the running website.

Details

· For example, the only change to the CSHTML file is the href attribute of an anchor tag. When examining the file in the browser, it does not use the updated href.

What we’ve tried thus far

· Clearing the browser cache does not fix the issue.

· Changes to static resources are properly and immediately reflected in the browser, so this issue specifically affects CSHTML files. · Following https://stackoverflow.com/q/63812846/11110116, but no *.Views.dll file exists on the server, and the modified date of all files in the bin directory match that of the CSHTML file.

· Restarting the application in IIS does not fix the issue.

· Changing, renaming, or deleting any CSHTML files on the server does not affect the deployed application; it continues to serve the old file.

Developer technologies | .NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,550 Reputation points Microsoft Employee Moderator
    2023-06-19T04:46:31.7366667+00:00

    @Zhang, Cen@DTSC Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I understand that even after deploying the new and updated cshtml file on the IIS, the href attribute is still not updated on the browser.

    Thanks for sharing the steps that you have tried so far. This will help us to avoid duplicate efforts in sharing the action plan. I am sharing a few of the action plans which can be followed to isolate this issue further.

    Isolation steps:

    1. Could you please try from a different browser ? Also try opening the browser in private (Incognito) mode and check the behavior? Also try doing hard refresh ( ctrl+ F5) on the browser
    2. Collect fiddler traces and check the response headers sent by the server. Check the Server Header to confirm if this was indeed IIS or any other intermediate devices.
      User's image
    3. Disable the Output Caching on IIS.
      User's image
    4. Clear the ASP.NET temporary files from the folder C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files and then rebuild your code.
    5. Also try browsing your application locally on the IIS (via localhost) and check if you are getting the right values.
    6. Try adding the HTTP Response Header from the IIS by Navigating to the website and clicking on the HTTP Response Headers and then select Set common headers with below setting, which will add the Cache-Control: nocache response headers in the response.
      User's image

    **

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.