微软上的范例:http://msdn.microsoft.com/zh-cn/library/ms243399但是在我本地运行web层的单元测试,一直报Could not connect to the Web server for page 'http://localhost:8549/'. 远程服务器返回错误: (500) 内部服务器错误。. Check that the Web server is running and visible on the network and that the page specified exists.这样的错误。我该如何配置?
请各位赐教...

解决方案 »

  1.   

    那个讲的web service 的单元测试
      

  2.   

    请问下,web层的测试该怎么做呢?
      

  3.   

            /// <summary>
            ///
            ///</summary>
            // TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
            // http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
            // whether you are testing a page, web service, or a WCF service.
            [TestMethod()]
            [HostType("ASP.NET")]
            [AspNetDevelopmentServerHost("D:\\...\\..._CODE\\...\\PresentationLayer\\....Presentation.Web", "/")]
            [UrlToTest("http://localhost:8549/")]
            [DeploymentItem("Lrs.Presentation.Web.dll")]
            public void InsertCodeExtensionInfoTest()
            {
                //Arrange
                CodeList_Accessor target = new CodeList_Accessor(); // TODO: Initialize to an appropriate value            //Act
                int expected = 1;
                int actual = 1;
                try
                {
                    target.InsertCodeExtensionInfo();
                }
                catch
                {
                    actual = 0;
                }            //Assert 
                Assert.AreEqual(expected, actual);       
            }你好,以上是我web层的一个测试代码。运行这个单元测试项,就会报我最先发的那个错...我要测试web层中的所有方法,包括事件等...可能我的方法不对,如您有好的建议,请不吝赐教...
      

  4.   

    呃...发现测试web层,就把那些url什么的删掉就行了...