I created the default asmx hello world web service by default:
namespace WebServiceHello
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
Then I create an MS test with Visual Studio and set the expected value:
[TestMethod()]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("C:\\temp\\WebServiceHello\\WebServiceHello", "/")]
[UrlToTest("http://localhost:7352/")]
public void HelloWorldTest()
{
Service1 target = new Service1();
string expected = "Hello World";
string actual;
actual = target.HelloWorld();
Assert.AreEqual(expected, actual);
}
but I got this error message:
- 'http://localhost: 7352/' . - ( ASP.NET , ) ASP.NET(URL- HTML-, -, ). ASP.NET URL- ASP.NET . 'WebRequestResponse_HelloWorldTest.html' ; - .
:
WebRequestResponse_HelloWorldTest.html
<html>
<head>
<title>Directory Listing -- /</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: 8pt;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: 8pt}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<h2> <i>Directory Listing -- /</i> </h2></span>
<hr width=100% size=1 color=silver>
<PRE>
Saturday, September 25, 2010 06:39 PM <dir> <A href="App_Data/">App_Data</A>
Saturday, September 25, 2010 06:40 PM <dir> <A href="bin/">bin</A>
Saturday, September 25, 2010 06:39 PM <dir> <A href="obj/">obj</A>
Saturday, September 25, 2010 06:39 PM <dir> <A href="Properties/">Properties</A>
Saturday, September 25, 2010 06:39 PM 97 <A href="Service1.asmx">Service1.asmx</A>
Saturday, September 25, 2010 06:39 PM 572 <A href="Service1.asmx.cs">Service1.asmx.cs</A>
Saturday, September 25, 2010 06:44 PM 3,551 <A href="Web.config">Web.config</A>
Saturday, September 25, 2010 06:39 PM 968 <A href="web.config.backup">web.config.backup</A>
Saturday, September 25, 2010 06:39 PM 1,285 <A href="Web.Debug.config">Web.Debug.config</A>
Saturday, September 25, 2010 06:39 PM 1,346 <A href="Web.Release.config">Web.Release.config</A>
Saturday, September 25, 2010 06:40 PM 3,805 <A href="WebServiceHello.csproj">WebServiceHello.csproj</A>
Saturday, September 25, 2010 06:40 PM 1,086 <A href="WebServiceHello.csproj.user">WebServiceHello.csproj.user</A>
</PRE>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> ASP.NET Development Server 10.0.0.0
</font>
</body>
</html>
, , ?