Failed to map the path '/'. .net 4.0

后端 未结 4 1157
滥情空心
滥情空心 2021-02-18 20:35

I have a .net app that I just opened on in visual studio 2010 and converted to 4.0 when it asked me on start-up. I go to try to build the site, and I get this error:

<         


        
相关标签:
4条回答
  • 2021-02-18 21:13

    We had the same problem, IISRESET didn't do it. It turned out that the Virtual Directory we trying to map has a double backslash (d:\folder\\subfolder\) in the naming (IIS virtual directory was created with powershell script). Removing the extra backslash made HostingEnvironment.MapPath stop throwing exceptions.

    Just in the case this could help somebody :-)

    0 讨论(0)
  • 2021-02-18 21:18

    I know it's and old question, but for the record if you are running against IIS then

    'iisreset' in the console may help resolving "Failed to map the path '/'." issue. I had this problem after renaming the sites in IIS.

    0 讨论(0)
  • 2021-02-18 21:22

    Try System.Web.HttpContext.Current.Server.MapPath("~/"). Notice the ~.

    0 讨论(0)
  • 2021-02-18 21:26

    I was just trying to go through an exercise in a Microsoft Step By Step book and I hit this problem when trying to precompile an ASP.NET appliction.

    Here's how I got past this - and it took me a day to figure out!

    When you open the Visual Studio Command Prompt to do your build/precompile, you must right-click and choose "Run As Administrator".

    That's all it took for me when trying to run this aspnet_compiler -v DeployThis C:\DeployThis -f -u

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