在Windows服务中调用WCF服务

在Windows服务中调用WCF服务,wcf,Wcf,我的应用程序在IIS中托管了WCF服务。我有另一个应用程序正在通过Windows服务运行。现在我需要在windows服务中使用IIS服务(带有wsHTTPBinding的WCF) 我尝试在windows服务中创建代理,但windows服务没有重新登录代理 任何人都可以通过以下示例代码帮助我:如何从Windows服务调用IIS中托管的WCF服务 我附上了错误信息 [System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceMode

我的应用程序在IIS中托管了WCF服务。我有另一个应用程序正在通过Windows服务运行。现在我需要在windows服务中使用IIS服务(带有wsHTTPBinding的WCF)

我尝试在windows服务中创建代理,但windows服务没有重新登录代理

任何人都可以通过以下示例代码帮助我:如何从Windows服务调用IIS中托管的WCF服务

我附上了错误信息

[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceModel”,“4.0.0.0”)]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName=“ServiceReference1.IService1”)]
公共接口IService1{
[System.ServiceModel.OperationContractAttribute(操作=”http://tempuri.org/IService1/GetData,ReplyAction=http://tempuri.org/IService1/GetDataResponse")]
字符串GetData(int值);
[System.ServiceModel.OperationContractAttribute(操作=”http://tempuri.org/IService1/GetData,ReplyAction=http://tempuri.org/IService1/GetDataResponse")]
System.Threading.Tasks.Task GetDataAsync(int值);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceModel”,“4.0.0.0”)]
公共接口IService1通道:FileMgntService.ServiceReference1.IService1,System.ServiceModel.IClientChannel{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceModel”,“4.0.0.0”)]
公共部分类Service1客户端:System.ServiceModel.ClientBase,FileMgntService.ServiceReference1.IService1{
公共服务1客户机(){
}
公共服务1客户端(字符串endpointConfigurationName):
基本(endpointConfigurationName){
}
公共服务1客户端(字符串endpointConfigurationName、字符串remoteAddress):
基本(endpointConfigurationName,remoteAddress){
}
公共服务1客户端(字符串endpointConfigurationName,System.ServiceModel.EndpointAddress remoteAddress):
基本(endpointConfigurationName,remoteAddress){
}
公共服务1客户端(System.ServiceModel.Channel.Binding绑定,System.ServiceModel.EndpointAddress remoteAddress):
基址(绑定、远程地址){
}
公共字符串GetData(int值){
返回base.Channel.GetData(值);
}
public System.Threading.Tasks.Task GetDataAsync(int值){
返回base.Channel.GetDataAsync(值);
}
}

发布您尝试过的代码,并澄清“windows服务无法识别”的含义。从Windows服务调用WCF服务应该没有问题。我在reference.cs文件中遇到上述错误。请发布实际错误,而不是图片,不是每个人都可以从工作区查看图像。我在“FileMgntService.ServiceReference1.IService1”中遇到错误。类型FileMgntService中不存在类型名称“ServiceReference1”。
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReference1.IService1")]
public interface IService1 {

    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService1/GetData", ReplyAction="http://tempuri.org/IService1/GetDataResponse")]
    string GetData(int value);

    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService1/GetData", ReplyAction="http://tempuri.org/IService1/GetDataResponse")]
    System.Threading.Tasks.Task<string> GetDataAsync(int value);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IService1Channel : FileMgntService.ServiceReference1.IService1, System.ServiceModel.IClientChannel {
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class Service1Client : System.ServiceModel.ClientBase<FileMgntService.ServiceReference1.IService1>, FileMgntService.ServiceReference1.IService1 {

    public Service1Client() {
    }

    public Service1Client(string endpointConfigurationName) : 
            base(endpointConfigurationName) {
    }

    public Service1Client(string endpointConfigurationName, string remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
    }

    public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
    }

    public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(binding, remoteAddress) {
    }

    public string GetData(int value) {
        return base.Channel.GetData(value);
    }

    public System.Threading.Tasks.Task<string> GetDataAsync(int value) {
        return base.Channel.GetDataAsync(value);
    }
}