View does not refresh after change

前端 未结 7 1432
北恋
北恋 2020-12-18 20:16

I am having this frustrating problem. I change text in a razor view (cshtml), Start without Debugging, refresh (Ctrl+F5) the browser but nothing happens. The st

7条回答
  •  长情又很酷
    2020-12-18 21:08

    There are two ways to resolve this issue:

    1. Check the permissions of folder in which your .sln file present.There may be a problem with file access permissions as Visual studio may not be to access files when IIS express server is running, so to reflect new .cshtml changes each time you need to restart the server,so I suggest edit the folder access permissions by:

    Right click on folder->properties->security->click on edit button -> check all options->save.

    Restart Visual studio to see changes.

    If this does not work then use 2 option.

    2.In your project in startup.cs file add this below line ConfigureServices() in method :

    services.AddMvc().AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true);

提交回复
热议问题