C# ASP核心“;[url]上没有可接受消息的侦听端点&引用;

C# ASP核心“;[url]上没有可接受消息的侦听端点&引用;,c#,wcf,asp.net-core,.net-core,C#,Wcf,Asp.net Core,.net Core,我有一个使用WCF服务的ASP核心应用程序 例如: 我有一台新电脑(旧的是赢7,新的是赢10) 我有完全相同的项目,但现在我得到了这个错误: 没有端点在侦听 这可以接受这个信息。 这通常是由不正确的地址或SOAP操作引起的 当我尝试通过浏览器-->确定访问服务时 当我尝试在旧计算机上运行应用程序-->确定 当我尝试在WCF托管的计算机上运行应用程序时(所以它在localhost上,也就是win 10)-->OK 什么会导致问题?操作系统、防火墙、McAffee 我在stackoverflow上看

我有一个使用WCF服务的ASP核心应用程序

例如:

我有一台新电脑(旧的是赢7,新的是赢10)

我有完全相同的项目,但现在我得到了这个错误:

没有端点在侦听 这可以接受这个信息。 这通常是由不正确的地址或SOAP操作引起的

当我尝试通过浏览器-->确定访问服务时 当我尝试在旧计算机上运行应用程序-->确定 当我尝试在WCF托管的计算机上运行应用程序时(所以它在localhost上,也就是win 10)-->OK

什么会导致问题?操作系统、防火墙、McAffee

我在stackoverflow上看到了很多pot,很多pot都在web.config中编辑一些绑定,但我没有web.config(如果我理解得很清楚的话,web.config是在发布asp核心时生成的)

谢谢你的每一个想法

编辑1-添加生成的Reference.cs文件

名称空间MesWCF { 使用System.Runtime.Serialization

 // My classes here 

[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "MesWCF.IService")]
public interface IService
{
   //My methods here - example bellow

    //Example of one methods (collapsed above for brevity)
    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService/GetUserAccount", ReplyAction = "http://tempuri.org/IService/GetUserAccountResponse")]
    System.Threading.Tasks.Task<MesWCF.FraMesUser> GetUserAccountAsync(string name, string password);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")]
public interface IServiceChannel : MesWCF.IService, System.ServiceModel.IClientChannel
{
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")]
public partial class ServiceClient : System.ServiceModel.ClientBase<MesWCF.IService>, MesWCF.IService
{

    /// <summary>
    /// Implement this partial method to configure the service endpoint.
    /// </summary>
    /// <param name="serviceEndpoint">The endpoint to configure</param>
    /// <param name="clientCredentials">The client credentials</param>
    static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);

    public ServiceClient() :
            base(ServiceClient.GetDefaultBinding(), ServiceClient.GetDefaultEndpointAddress())
    {
        this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IService.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public ServiceClient(EndpointConfiguration endpointConfiguration) :
            base(ServiceClient.GetBindingForEndpoint(endpointConfiguration), ServiceClient.GetEndpointAddress(endpointConfiguration))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public ServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
            base(ServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public ServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
            base(ServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

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

  //Methods here 

  //Example of one method (collapsed above for brevity)
    public System.Threading.Tasks.Task<MesWCF.FraMesUser> GetUserAccountAsync(string name, string password)
    {
        return base.Channel.GetUserAccountAsync(name, password);
    }
    public virtual System.Threading.Tasks.Task OpenAsync()
    {
        return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
    }

    public virtual System.Threading.Tasks.Task CloseAsync()
    {
        return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
    }

    private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IService))
        {
            System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
            result.MaxBufferSize = int.MaxValue;
            result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
            result.MaxReceivedMessageSize = int.MaxValue;
            result.AllowCookies = true;
            return result;
        }
        throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
    }

    private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IService))
        {
            return new System.ServiceModel.EndpointAddress("http://10.208.132.246:12345/Service.svc");
        }
        throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
    }

    private static System.ServiceModel.Channels.Binding GetDefaultBinding()
    {
        return ServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IService);
    }

    private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
    {
        return ServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IService);
    }

    public enum EndpointConfiguration
    {

        BasicHttpBinding_IService,
    }
}
}
//这里是我的类
[System.CodeDom.Compiler.GeneratedCodeAttribute(“dotnet svcuti”,“1.0.0.0”)]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName=“MesWCF.IService”)]
公共接口设备
{
//我在这里的方法-示例如下
//一种方法的示例(为简洁起见,折叠在上面)
[System.ServiceModel.OperationContractAttribute(操作=”http://tempuri.org/IService/GetUserAccount,ReplyAction=http://tempuri.org/IService/GetUserAccountResponse")]
System.Threading.Tasks.Task GetUserAccountAsync(字符串名称、字符串密码);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute(“dotnet svcuti”,“1.0.0.0”)]
公共接口iSeries通道:MesWCF.IService,System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute(“dotnet svcuti”,“1.0.0.0”)]
公共部分类ServiceClient:System.ServiceModel.ClientBase,MesWCF.IService
{
/// 
///实现此分部方法以配置服务端点。
/// 
///要配置的端点
///客户端凭据
静态部分无效ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint ServiceEndpoint,System.ServiceModel.Description.ClientCredentials ClientCredentials);
公共服务客户端():
基本(ServiceClient.GetDefaultBinding(),ServiceClient.GetDefaultEndpointAddress())
{
this.Endpoint.Name=EndpointConfiguration.BasicHttpBinding_IService.ToString();
ConfigureEndpoint(this.Endpoint,this.ClientCredentials);
}
公共服务客户端(端点配置端点配置):
基本(ServiceClient.GetBindingForEndpoint(endpointConfiguration),ServiceClient.GetEndpointAddress(endpointConfiguration))
{
this.Endpoint.Name=endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint,this.ClientCredentials);
}
公共服务客户端(EndpointConfiguration EndpointConfiguration,字符串remoteAddress):
基本(ServiceClient.GetBindingForEndpoint(endpointConfiguration),新系统.ServiceModel.EndpointAddress(remoteAddress))
{
this.Endpoint.Name=endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint,this.ClientCredentials);
}
公共服务客户端(EndpointConfiguration EndpointConfiguration,System.ServiceModel.EndpointAddress remoteAddress):
基本(ServiceClient.GetBindingForEndpoint(endpointConfiguration),remoteAddress)
{
this.Endpoint.Name=endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint,this.ClientCredentials);
}
公共ServiceClient(System.ServiceModel.Channel.Binding绑定,System.ServiceModel.EndpointAddress remoteAddress):
基址(绑定、远程地址)
{
}
//这里的方法
//一种方法的示例(为简洁起见,在上面折叠)
public System.Threading.Tasks.Task GetUserAccountAsync(字符串名称、字符串密码)
{
返回base.Channel.GetUserAccountAsync(名称、密码);
}
公共虚拟系统.Threading.Tasks.Task OpenAsync()
{
返回System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null,null),new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen);
}
public virtual System.Threading.Tasks.Task CloseAsync()
{
返回System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null,null),new System.Action((System.ServiceModel.ICommunicationObject)(this)).EndClose);
}
私有静态System.ServiceModel.Channel.Binding GetBindingForEndpoint(EndpointConfiguration EndpointConfiguration)
{
if((endpointConfiguration==endpointConfiguration.BasicHttpBinding_IService))
{
System.ServiceModel.BasicHttpBinding结果=新建System.ServiceModel.BasicHttpBinding();
result.MaxBufferSize=int.MaxValue;
result.ReaderQuotas=System.Xml.XmlDictionaryReaderQuotas.Max;
result.MaxReceivedMessageSize=int.MaxValue;
result.AllowCookies=true;
返回结果;
}
抛出新的System.InvalidOperationException(string.Format(“找不到名为\'{0}\'”,endpointConfiguration)的端点);
}
私有静态System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration EndpointConfiguration)
{
if((endpointConfiguration==endpointConfiguration.BasicHttpBinding_IService))
{
返回新的System.ServiceModel.EndpointAddress(“http://10.208.132.246:12345/Service.svc");
}
抛出新的System.InvalidOperationException(string.Format(“找不到名为\'{0}\'”,endpointConfiguration)的端点);
}
专用静态System.ServiceModel.Channel.Bindin
 // My classes here 

[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "MesWCF.IService")]
public interface IService
{
   //My methods here - example bellow

    //Example of one methods (collapsed above for brevity)
    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService/GetUserAccount", ReplyAction = "http://tempuri.org/IService/GetUserAccountResponse")]
    System.Threading.Tasks.Task<MesWCF.FraMesUser> GetUserAccountAsync(string name, string password);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")]
public interface IServiceChannel : MesWCF.IService, System.ServiceModel.IClientChannel
{
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")]
public partial class ServiceClient : System.ServiceModel.ClientBase<MesWCF.IService>, MesWCF.IService
{

    /// <summary>
    /// Implement this partial method to configure the service endpoint.
    /// </summary>
    /// <param name="serviceEndpoint">The endpoint to configure</param>
    /// <param name="clientCredentials">The client credentials</param>
    static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);

    public ServiceClient() :
            base(ServiceClient.GetDefaultBinding(), ServiceClient.GetDefaultEndpointAddress())
    {
        this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IService.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public ServiceClient(EndpointConfiguration endpointConfiguration) :
            base(ServiceClient.GetBindingForEndpoint(endpointConfiguration), ServiceClient.GetEndpointAddress(endpointConfiguration))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public ServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
            base(ServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public ServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
            base(ServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

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

  //Methods here 

  //Example of one method (collapsed above for brevity)
    public System.Threading.Tasks.Task<MesWCF.FraMesUser> GetUserAccountAsync(string name, string password)
    {
        return base.Channel.GetUserAccountAsync(name, password);
    }
    public virtual System.Threading.Tasks.Task OpenAsync()
    {
        return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
    }

    public virtual System.Threading.Tasks.Task CloseAsync()
    {
        return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
    }

    private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IService))
        {
            System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
            result.MaxBufferSize = int.MaxValue;
            result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
            result.MaxReceivedMessageSize = int.MaxValue;
            result.AllowCookies = true;
            return result;
        }
        throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
    }

    private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IService))
        {
            return new System.ServiceModel.EndpointAddress("http://10.208.132.246:12345/Service.svc");
        }
        throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
    }

    private static System.ServiceModel.Channels.Binding GetDefaultBinding()
    {
        return ServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IService);
    }

    private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
    {
        return ServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IService);
    }

    public enum EndpointConfiguration
    {

        BasicHttpBinding_IService,
    }
}
}