我创建了一个想要使用的WCF web服务。在我的客户端上,我添加了一个新的服务参考。它找到了它,我给它一个名称空间,然后单击"确定"。它生成了适当的代码,但当我重建应用程序时,我得到了一个错误:
Circular base class dependency involving 'WSHelperClient' and 'WSHelperClient'
这是自动生成的代码。如果我将"WSHelperClient.WSHelper."替换为",它将修复Circular基类依赖性错误。
有人知道为什么自动生成的代码没有编译,而我需要手动更改它吗?
namespace WSHelperClient.WSHelper {
using System.Runtime.Serialization;
using System;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="PowerShellResponse", Namespace="http://schemas.datacontract.org/2004/07/WSHelper")]
[System.SerializableAttribute()]
public partial class PowerShellResponse : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
[System.NonSerializedAttribute()]
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private string DescriptionField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private bool HadErrorsField;
[global::System.ComponentModel.BrowsableAttribute(false)]
public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
get {
return this.extensionDataField;
}
set {
this.extensionDataField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string Description {
get {
return this.DescriptionField;
}
set {
if ((object.ReferenceEquals(this.DescriptionField, value) != true)) {
this.DescriptionField = value;
this.RaisePropertyChanged("Description");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public bool HadErrors {
get {
return this.HadErrorsField;
}
set {
if ((this.HadErrorsField.Equals(value) != true)) {
this.HadErrorsField = value;
this.RaisePropertyChanged("HadErrors");
}
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="WSHelper.IWSHelper")]
public interface IWSHelper {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWSHelper/ConvertUserMailboxToShared", ReplyAction="http://tempuri.org/IWSHelper/ConvertUserMailboxToSharedResponse")]
WSHelperClient.WSHelper.PowerShellResponse ConvertUserMailboxToShared(string email);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWSHelper/ConvertUserMailboxToShared", ReplyAction="http://tempuri.org/IWSHelper/ConvertUserMailboxToSharedResponse")]
System.Threading.Tasks.Task<WSHelperClient.WSHelper.PowerShellResponse> ConvertUserMailboxToSharedAsync(string email);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWSHelper/RemoveUserLicences", ReplyAction="http://tempuri.org/IWSHelper/RemoveUserLicencesResponse")]
WSHelperClient.WSHelper.PowerShellResponse RemoveUserLicences(string upn);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWSHelper/RemoveUserLicences", ReplyAction="http://tempuri.org/IWSHelper/RemoveUserLicencesResponse")]
System.Threading.Tasks.Task<WSHelperClient.WSHelper.PowerShellResponse> RemoveUserLicencesAsync(string upn);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWSHelper/RemoveMailboxFromAddressBook", ReplyAction="http://tempuri.org/IWSHelper/RemoveMailboxFromAddressBookResponse")]
WSHelperClient.WSHelper.PowerShellResponse RemoveMailboxFromAddressBook(string email);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWSHelper/RemoveMailboxFromAddressBook", ReplyAction="http://tempuri.org/IWSHelper/RemoveMailboxFromAddressBookResponse")]
System.Threading.Tasks.Task<WSHelperClient.WSHelper.PowerShellResponse> RemoveMailboxFromAddressBookAsync(string email);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IWSHelperChannel : WSHelperClient.WSHelper.IWSHelper, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class WSHelperClient : System.ServiceModel.ClientBase<WSHelperClient.WSHelper.IWSHelper>, WSHelperClient.WSHelper.IWSHelper {
public WSHelperClient() {
}
public WSHelperClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public WSHelperClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public WSHelperClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public WSHelperClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public WSHelperClient.WSHelper.PowerShellResponse ConvertUserMailboxToShared(string email) {
return base.Channel.ConvertUserMailboxToShared(email);
}
public System.Threading.Tasks.Task<WSHelperClient.WSHelper.PowerShellResponse> ConvertUserMailboxToSharedAsync(string email) {
return base.Channel.ConvertUserMailboxToSharedAsync(email);
}
public WSHelperClient.WSHelper.PowerShellResponse RemoveUserLicences(string upn) {
return base.Channel.RemoveUserLicences(upn);
}
public System.Threading.Tasks.Task<WSHelperClient.WSHelper.PowerShellResponse> RemoveUserLicencesAsync(string upn) {
return base.Channel.RemoveUserLicencesAsync(upn);
}
public WSHelperClient.WSHelper.PowerShellResponse RemoveMailboxFromAddressBook(string email) {
return base.Channel.RemoveMailboxFromAddressBook(email);
}
public System.Threading.Tasks.Task<WSHelperClient.WSHelper.PowerShellResponse> RemoveMailboxFromAddressBookAsync(string email) {
return base.Channel.RemoveMailboxFromAddressBookAsync(email);
}
}
}
问题是我将项目命名为WSHelperClient,这与服务代码冲突。所以我打电话给我的客户WSHelperWindowsClient,它解决了这个问题。