IIS Express - 500.19 Cannot read configuration file - because it's looking at the wrong path

前端 未结 14 1114
梦如初夏
梦如初夏 2021-02-01 00:42

I recently renamed my root TFS folder from D:\\TFS\\systemstfs to D:\\TFS\\sys because one of the project\'s paths was too long for Windows. Now, when

相关标签:
14条回答
  • 2021-02-01 00:58

    I solved this by going into the project properties > Web > and clicking "Create virtual directory" then I didn't have to change my ports.

    0 讨论(0)
  • 2021-02-01 01:00

    In my case, the wrong path was recorded in a .vs folder in the zip i received from colleague. Normally, I'd get source through source repository where .vs is not checked in.

    Deleting the .vs folder resolved the problem for me.

    0 讨论(0)
  • 2021-02-01 01:01

    Changing the port number on my MVC project resolved my issue. I went in circles for over an hour looking for an answer. Thank you Sonic Soul.

    It always amazes me when one tiny tweak can fix something horribly broken.

    I incremented the port number and the error magically resolved.

    Project Properties > Web > Project Url 
    

    Using Visual Studios 2015.

    0 讨论(0)
  • 2021-02-01 01:01

    In my case I replace .. in my path with a normal folder path.

    TL;DR

    I did the "clever" trick of utilising the relative path of my script file as I did not want to hard code my folder address.

    "C:\Program Files\IIS Express\iisexpress.exe" /path:"%~dp0..\Lagardsdorren\bin\Debug\netcoreapp2.2\publish" /port:44342
    

    I knew, but it took my some time to realise, that .. is non grata in IIS(express) as it makes it possible to path yourself out of your sites home directory. In my case it didn't but I guess IIS(express) just stops anything with .. in it.

    I don't know how to get back to my clever relative path, but that is for another question.

    0 讨论(0)
  • 2021-02-01 01:05

    My setup is a .NET 4.6.1 MVC project hosted as an Azure Cloud Service. I got this error when running locally with Visual Studio 2019 and IIS Express. I was able to fix the error. In my case the error was a red herring and was a symptom of another problem. For me, I had to remove my references to System.http.net, System.runtime, and System.Runtime.InteropServices. Then I added the latest version of those those three references back with Nuget.

    The issue was that my code could not find those three packages. It has issues finding the packages every time I switch my git branch, but that's a completely separate error, and one I'm still trying to resolve. The way I figured out what was wrong was I would run the code and look at the "build" and "debug" output in Visual Studio 2019. I saw errors relating to the code not being able to find System.Http.Net, so I fixed that, then saw the errors with the other packages and fixed them. The real issue was that my code was getting exceptions and not running correctly, it just happened to manifest as this 500.19 error.

    Another possibly contributing factor is that I disabled "just my code" earlier in the day. This seemed to cause my code to not break when exceptions were encountered. Once I turned this back on, my code would break when an exception happened, and this also helped me figure out the cause of the problem. To find this option, go into Tools > Options > Debugging > General > "Enable Just My Code".

    Original error:

    0 讨论(0)
  • 2021-02-01 01:06

    Turns out I had to edit %USERPROFILE%\Documents\IISExpress\config\applicationhost.config in the following way -

    <configuration>
      <system.applicationHost>
        <sites>
          <site name="wsBusinessLayer">
            <application path="/">
               <virtualDirectory path="/Flowers" physicalPath="D:\TFS\sys\companydomain.com\Dev\Flowers" />
    

    I don't know how this file gets changed "properly", but editing it manually worked fine.

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