我想在.NET中創建一個WebService誰揭露多的WebMethods如何覆蓋生成WSDL在Web服務的.Net
我需要每個新執行一個WebService版本(或的WebMethod屬性的新的業務對象),如這樣的:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
[WebMethod]
[WebServiceVersion("1.0")]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
[WebServiceVersion("1.1")]
public string NewMethodInVersion1_1()
{
return "Hello World";
}
}
用URL重寫或HttpHandler的:
的HelloWorld唯一的WebMethod:http://localhost/Service/1.0/Service.asmx
^h elloWorld WebMethod和NewMethodInVersion1_1:http://localhost/Service/1.1/Service.asmx
如何爲客戶使用的特定版本動態生成wsdl?
如果錯誤發生在1.0版本,我需要釋放修補程序,無需部署的 新版本的新的WebMethod或財產,我不想要在VSS或TFS中分支我的WebService的多個版本 – Jni 2010-08-04 11:59:33
難道你不得不以任何方式發佈,因爲你必須修復版本1.0後面的代碼。 我的方法可以讓你發佈1.0版本的代碼,而不會影響web服務的1.1版本? – Datoon 2010-08-04 12:04:45
我不能使用2個WebApplication,因爲將來會添加業務對象的新屬性,所以我需要在每個版本中分開wsdl修改。 在舊項目中,我在IIS上的分隔符WebApplication上將每個版本部署在服務器上。但是,當發生錯誤時,在每個Web應用程序版本中都很難修復。 – Jni 2010-08-04 12:11:51