Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET单元测试目录NotFoundException_Asp.net_Visual Studio_Unit Testing - Fatal编程技术网

ASP.NET单元测试目录NotFoundException

ASP.NET单元测试目录NotFoundException,asp.net,visual-studio,unit-testing,Asp.net,Visual Studio,Unit Testing,我正在尝试运行ASP.NET单元测试,但一直收到DirectoryNotFoundException:找不到路径“C:\inetpub\wwwroot\WebsiteName\GPS\web.config”的一部分。问题是GPS web.config的路径是C:\inetpub\wwwroot\WebsiteName\website\GPS\web.config。我不知道如何设置这个web.config的路径。我的属性发布在下面。正如你所看到的,逻辑约定似乎是测试所要寻找的,但我们的网站并不是这

我正在尝试运行ASP.NET单元测试,但一直收到DirectoryNotFoundException:找不到路径“C:\inetpub\wwwroot\WebsiteName\GPS\web.config”的一部分。问题是GPS web.config的路径是C:\inetpub\wwwroot\WebsiteName\website\GPS\web.config。我不知道如何设置这个web.config的路径。我的属性发布在下面。正如你所看到的,逻辑约定似乎是测试所要寻找的,但我们的网站并不是这样设置的。任何帮助都将不胜感激

    [TestMethod()]
    [HostType("ASP.NET")]
    [UrlToTest("http://localhost/WebsiteName/GPS/Default.aspx")]
    [DeploymentItem("GPS.dll")]

您不应该将UrlToTest属性参数更改为

它不起作用,因为实际的网站url为。