Note that there are some explanatory texts on larger screens.

plurals
  1. POVS2010 and ASP.NET unit test problems / WebHostAdapter exception
    text
    copied!<p>I've spent half a day trying to get an ASP.NET unit test to work as described in <a href="http://www.gangleri.net/2007/12/29/UnitTestingASPNetApplicationsWithVisualStudio2008.aspx" rel="noreferrer">Alan's Development Blog</a>. I don't have VS2008 but VS2010 with SP1 and Resharper 5.1, and no matter what I try I just run into different kinds of errors. </p> <p>When I add a test project with a test method as follows and specify .NET 4 as target framework, I run into exception</p> <p><strong>Updated to show more detailed information about the exception</strong></p> <p><em>"The test adapter 'WebHostAdpater' threw an exception while running test 'TestMethod1'. The web site could not be configured correctly; getting ASP.NET process information failed. Requesting '<a href="http://localhost:49676/VSEnterpriseHelper.axd" rel="noreferrer">http://localhost:49676/VSEnterpriseHelper.axd</a>' returned an error: The remote server returned an error: (500) Internal Server Error..."</em></p> <pre><code>[TestMethod] [HostType( "ASP.NET" )] [UrlToTest( "http://localhost:49676/Default.aspx" )] [AspNetDevelopmentServerHost( @"C:\...\Projects\ProjectX\ProjectX\", "/Default.aspx") ] public void TestMethod1() { } </code></pre> <p>I've performed numerous searches on the internet regarding this error message, but never really found a solution - I tried adding a section so all users would be allowed access to "VSEnterpriseHelper.axd" which is also mentioned in the error message, but it didn't help.</p> <p>Trying to set the test project's target framework to .NET 3.5 also doesn't help and returns the same error.</p> <p>While playing around with different settings I also happened to get the error message that the assembly "Microsoft.VisualStudio.QualityTools.CommandLine" couldn't be loaded, even though I added the correct version (with the correct public key token) as reference.</p> <p>Maybe the combination of things (ReSharper, .NET target framework, ...) messes things up, but I also tried disabling the ReSharper unit testing so that MSTest would be used, unfortunately to no avail.</p> <p>The description in Alan's blog post seems to be quite straightforward, but it doesn't want to work for me.</p> <p><strong>Update 2</strong></p> <p>I also tried to run the example projects from Alan's page in VS2008, but the error is still the same as in VS2010 SP1.</p> <p><strong>Update 3</strong></p> <p>Still no luck, but I've added the file <em>Microsoft.VisualStudio.Enterprise.AspNetHelper.dll</em> (located in <em>%PROGRAMFILES%\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies</em>) to the web.config as a <em>ConfigurationErrorException</em> in the Windows Event Log indicated that this file was not found:</p> <pre><code>&lt;dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1"&gt; &lt;assemblyIdentityVersion name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /&gt; &lt;codeBase version="10.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.dll" /&gt; &lt;/dependentAssembly&gt; </code></pre> <p>This fixed the problem with the AspNetHelper.dll, but I get the same error message for the <em>AspNetAdatpter</em>, but amending the web.config in the same way doesn't work as the error persists. Within Visual Studio I can also see that (when I try to add a handler entry as shown below) the <em>QualityTools.HostAdapters.ASPNETAdapter</em> part is shown in red, indicating in a tooltip "Cannot resolve symbol 'QualityTools'":</p> <pre><code>&lt;add name="HostAdapter" verb="GET" path="ASPNETAdapter" type="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&gt; </code></pre> <p>This is all a big mess, and it seems I've completely lost track, why does it seem to be impossible to run ASP.NET unit tests within VS2010? Is there nobody else who's got the same kind of problems (or, ask the question differently, is there anybody who can run ASP.NET unit test in VS2010 without problems)?</p> <p>Still trying to get things working...</p> <p><strong>Update 4</strong></p> <p>Still no luck, am I the only one? Who can run such tests?</p> <p><strong>End of update</strong></p> <p>Any ideas what I'm doing wrong here? Thanks in advance for any pointers into the right direction</p> <p>G.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload