Testing MVC Web Application in Visual Studio and QTAgent Issue

I am trying to run Unit Test in visual studio for an MVC application and constantly getting the following error:

The specified URL ('http: // localhost: 21496 /') does not match a valid directory. Tests configured to run on ASP.NET in IIS require a valid directory for the URL. The URL may be invalid or may not point to a valid web application.

The only advice is to make sure you have the localhost address in the UrlToTest attribute, for example:

    [TestMethod()]
    [HostType("ASP.NET")]
    [UrlToTest("http://localhost:21496/")]

However, this still does not work with IIS Express or IIS 7 on Windows 7, and when I delved into the event logs, I found the following problem.

(QTAgent32.exe, PID 6976, Thread 15) WebSites.GetWebServer: failed to create AspNetHelper: Microsoft.VisualStudio.Enterprise.Common.AspNetHelperException: The website metabase contains unexpected information or you do not have permission to access the metabase.  You must be a member of the Administrators group on the local computer to access the IIS metabase. Therefore, you cannot create or open a local IIS Web site.  If you have Read, Write, and Modify Permissions for the folder where the files are located, you can create a file system web site that points to the folder in order to proceed. ---> System.Runtime.InteropServices.COMException: Unknown error (0x80005000)
   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_IsContainer()
   at System.DirectoryServices.DirectoryEntries.ChildEnumerator..ctor(DirectoryEntry container)
   at Microsoft.VisualStudio.Enterprise.Common.IISHelper.GetWebServerOrdinal(Uri site)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Enterprise.Common.IISHelper.GetWebServerOrdinal(Uri site)
   at Microsoft.VisualStudio.Enterprise.Common.IISHelper.get_WebServerOrdinal()
   at Microsoft.VisualStudio.Enterprise.Common.IISHelper.get_RootPath()
   at Microsoft.VisualStudio.Enterprise.Common.IISHelper.get_PhysicalPath()
   at Microsoft.VisualStudio.Enterprise.Common.AspNetHelperMan..ctor(Uri uri, BasicAuthCredential credential, Int32 frameworkMajorVersion)
   at Microsoft.VisualStudio.TestTools.HostAdapters.WebSites.GetWebServer(String webServerName, WebServerType webServerType, String urlToTest, String pathToWeb, String webAppRoot, BasicAuthCredential credential, Context context, WebSiteConfigurationType webSiteConfigType, Origin origin)

The next step I took was to make sure that QTAgent32 always works with administrator rights, as well as with visual studio.

, , - - .

+2
2

ASP.NET . , -, .

[HostType("ASP.NET")]
[UrlToTest("http://localhost:21496/")]
+2

( ). :

(QTAgent32.exe, PID 12348, Thread 61) WebSites.GetWebServer: failed to create AspNetHelper: Microsoft.VisualStudio.Enterprise.Common.AspNetHelperException: The website metabase contains unexpected information or you do not have permission to access the metabase.  You must be a member of the Administrators group on the local computer to access the IIS metabase. Therefore, you cannot create or open a local IIS Web site.  If you have Read, Write, and Modify Permissions for the folder where the files are located, you can create a file system web site that points to the folder in order to proceed. ---> System.Runtime.InteropServices.COMException: Unknown error (0x80005000)

, , , .

" Windows" IIS 6 . Windows 7 Home Premium, Windows, . , .

+1

All Articles