从在 Visual Studio 2010 Express 中开发的 .NET Web 服务开始,我怎样才能让自己的 Web 服务知道它自己提供的 WSDL 的 URL?
例如,如果我有一些样板代码
[WebService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class MyWS : System.Web.Services.WebService
{
[WebMethod(Description="Something like: http://localhost:12345/MyWS.asmx?WSDL")]
public int RegisterInDB(string ConnectionString)
{
string urlWSDL = "HOW_TO_GET_WEBSERVICE'S_OWN_WSDL_URL_HERE ???";
int NewRowId;
// 1) Connect to DB with ConnectionString
// 2) INSERT into table some info, including urlWSDL
// 3) Get Id of INSERT'ed row.
return NewRowId;
}
}
哪个方法/属性在运行时提供 WSDL?