2016-09-26 171 views
1

我想知道爲什麼當我使用WCF作爲Web服務時,客戶端中的類名稱更改爲「MyClass」+ Client。WCF客戶端類名稱

如何避免在我的WSDL中添加「客戶端」部分?

我的服務合同:

<ServiceContract()> 
Public Interface IOfficeEvaluation 
End Interface 

我的Web服務類:

<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> 
Public Class OfficeEvaluation 
    Implements IOfficeEvaluation 
End Class 

我的客戶(用途):

public partial class WebServiceSample : System.Web.UI.Page 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      var ws = new OfficeEvaluation.OfficeEvaluationClient(); 

     } 
    } 

在使用中,你可以看到我已經搞定了一個實例

OfficeEvaluationClient

,並在類名的末尾添加實在是我的神經

我怎樣才能擺脫客戶端的一部分?

回答

0

找了一段時間後,我發現「客戶端」部分是約定的,我們無法做到這一點。代理類名由.NET創建,查看接口名稱,然後將「I」 ,併爲課程名稱追加「客戶端」。