I'm developing an ASP.NET MVC 5 application that use KendoUI . If I run the project under IIS Express everything works fine... if I use IIS Local I got the following exception when I try to load a view
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
Additional information: Invalid file name for file monitoring: 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
I've just searched on google and someone suggest to disable under Debug->Exception the throw exception checkbox but if I do so I wouldn't get the view displayed since the output is just javascript...
Anyone has found a solution to this problem? Thanks
Some things you could try:
Check to ensure your 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates'
directory is available to the application.
First, determine what user account the IIS application pool assigned to the application.
Sites
.Basic Settings...
link in the right pane.Cancel
.Application Pools
node in the left pane.Now, the Identity could either be a built-in account (such as NetworkService, LocalSystem, LocalService, or ApplicationPoolIdentity), or it could be a local or domain user (if you are using Active Directory).
If it is a local or domain user, you just need to open the 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates'
directory in Windows Explorer, right-click on it, and choose Properties. Click the Security tab, and make sure the user is in the list. If not, click Edit...
, then click Add...
, and add the user to the list. Ensure it has enough permission to read the directory.
If using a built-in user, you could either switch it to a local user, or see this answer for the command to add permissions to the built-in account.
One thing in particular to check is the templateName
parameter of @Html.Editor()
or @Html.EditorFor()
in all of your views (or anywhere else you may happen to be calling it). This parameter should correspond with one of the formats here.
The most common usage is to specify just the name of the template. For example, if you specify MyTemplate
for this field, it will search several directories for the file (see the above document), ending up with ~/Views/Shared/EditorTemplates/MyTemplate.<extension>
, where extension will be .cshtml
, .vbhtml
, .aspx
, or .ascx
. This is the directory in your error message, so you should check these references thoroughly.
Even if you are not specifying the parameter explicitly, MVC uses a convention that the file name matches your view model name.
This is a long shot, since your application is running under IIS Express it shouldn't be the case. But you could try searching to see if there is any code in your application specifying a file in the 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates'
directory.
If so, make sure that the file name
I found a potential answer here.
You could attempt to clear your ASP.NET temporary files pertaining to the current application. Note that there are a few different places where they can be lurking depending on your framework version and bitness.
<Drive>:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
<Drive>:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
<Drive>:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
<Drive>:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
If you have the project open in Visual Studio, it will not let you delete the relevant files. Ultimately, you should close Visual Studio before deleting the files, but I found that leaving it open on the first attempt is a good way to determine which of the folders contains the application in question because you will get a message that the files are locked. Knowing that location can be useful if you have additional problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With