IIS Express 8 - Cannot write configuration file

后端 未结 12 1346
心在旅途
心在旅途 2021-01-01 09:16

I am trying to use IIS Express 8 for a MVC site in VS2012. I am getting the following error whenever I attempt to create the site:

Filename: \\?\\C:

相关标签:
12条回答
  • 2021-01-01 09:43

    I also had the problem and tried to fix it with setting the registry key in HKCU\Software\Microsoft which didn't work.

    The error I made, was using HKCU because, since I do not have permissions to edit the registry under by normal account (which I use to run visual studio), I was using an administrative account. Then of course, HKCU was for that account.

    So I just used HKEY_USERS\"my normal user's SID" instead and, when starting iisexpress.exe manually, it created its files at the location indicated. What still didn't work was using iisexpress from visual studio. It still seemed that VS didn't use the registry setting at all.

    Finally I resorted in setting a non UNC path for Shell Folders\Personal and User Shell Folders\Personal in HKU\"my normal user's SID"\Software\Microsoft\Windows\CurrentVersion\Explorer\ which did the trick.

    0 讨论(0)
  • 2021-01-01 09:49

    I had the same issue before, running VisualStudio as Administrator (Run as Administrtor) resolved the issue.

    0 讨论(0)
  • 2021-01-01 09:50

    After struggling with this, and verifying encryption and read-only attributes, and having them not work, my solution ended up being:

    • Navigate to the folder containing the IISExpress folder (in my case, it was in my OneDrive, not Documents folder)
    • Right click on IISExpress folder > Security tab > Advanced button
    • Change Owner to yourself, even if it already is
    • Check the "Replace owner on subcontainers and objects" box
      • This may not appear until you've completed the Change owner dialog
    • Open the IISExpress folder
    • Right click on config folder > Security tab > Advanced button
    • Add a user > Add principal
    • Change location to local machine (and not a domain)
    • Enter the name NETWORK SERVICE and "Check Names"
    • Press OK to get back to the Advance Security dialog
    • Make sure to check "Replace all child object permission entries with inheritable permission entries from this object"

    Worked in Windows 10 with IISExpress 10, for both VS 2013 and VS 2017.

    0 讨论(0)
  • 2021-01-01 09:53

    Adding the registry entry seemed to work, however, using environment variables in the registry entry did not. In my environment only our documents directory is redirected, so I simply wanted to move the IIS Express config directory up one level to the %USERPROFILE% directory. However, that did not work. IIS Express read the environment variable literally and of course failed to run.

    0 讨论(0)
  • 2021-01-01 09:55

    @Brad

    I had your same problem just now. Removing the encryption on the IISExpress folder and the "Read Only" attribute solved it. In my company Documents is also encrypted, but I don't think removing that encryption from IISExpress would be a problem of any sort.

    Hope this helps.

    0 讨论(0)
  • I had a very similar error message caused by a completely different problem.

    The Error:

    C:\VS\TFS_Projects\SomeSolution\SomeProject\SomeProject.csproj : error : Creation of the virtual directory http://localhost:55063/ failed with the error: Filename: \\?\C:\VS\TFS_Projects\SomeSolution.vs\config\applicationhost.config Error: Cannot write configuration file due to insufficient permissions

    More Details: I couldn't even open the project, as opening it would fail.

    I could get prior changesets, and they would actually open fine, but if I got latest the projects couldn't be opened.

    Solution: In my case, it turned out that when we changed TFS servers, someone had added the ".vs" folder to source control along with everything else. Under which, one developer had his applicationhost.config set up to run sites on a D:\ drive, while I had no such D:\ drive (well, it was a DVD drive.) I was able to get this working by finding a prior changeset with the un-altered applicationhost.config and replacing my local file. (I could have attempted to actually delete the folder, but I didn't go that route.)

    Afterwards, we removed the ".vs" folder from source control.

    (I put this solution here because it's where google landed me, so other people having this error message might find the above solutions don't fix it for them, and thus they might be having this problem.)

    0 讨论(0)
提交回复
热议问题