0
这是Visual Studio在向项目添加服务引用时生成的代码。 'ReminderServiceClient.ServiceReference1.IReminderService'的所有引用都不起作用,因为它找不到'ServiceReference1'。但是它在顶部的命名空间中定义?!为什么这个生成的代码不能编译?WCF服务引用生成的代码无法编译
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.296
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//-----------------------------------------------------------------------------
-
namespace ReminderServiceClient.ServiceReference1 {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReference1.IReminderService")]
public interface IReminderService {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IReminderService/DoWork", ReplyAction="http://tempuri.org/IReminderService/DoWorkResponse")]
void DoWork();
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IReminderServiceChannel : ReminderServiceClient.ServiceReference1.IReminderService, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class ReminderServiceClient : System.ServiceModel.ClientBase<ReminderServiceClient.ServiceReference1.IReminderService>, ReminderServiceClient.ServiceReference1.IReminderService {
public ReminderServiceClient() {
}
public ReminderServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public ReminderServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public ReminderServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public ReminderServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public void DoWork() {
base.Channel.DoWork();
}
}
}
此外,您将什么样的项目添加到服务引用?一个网站“项目”(文件 - >新网站)? – 2013-02-14 17:25:06
@JohnSaunders在哪里使用它?我将它添加到控制台应用程序项目中。 – 2013-02-14 17:39:41
我明白了。尝试做一个重建解决方案,看看是否有帮助。 – 2013-02-14 17:47:41