C# 无法从远程客户端连接到wcf服务

C# 无法从远程客户端连接到wcf服务,c#,wcf,vmware-player,C#,Wcf,Vmware Player,我正在使用Visual Studio 2015和C# 对于我的服务器: 我有一个控制台应用程序,在Program.cs中有以下代码: const string serviceURL = "http://localhost:1234/AccountService"; ServiceHost serviceHost = new ServiceHost( typeof(AccountService), new Uri(serviceURL)); ser

我正在使用Visual Studio 2015和C#

对于我的服务器: 我有一个控制台应用程序,在Program.cs中有以下代码:

const string serviceURL = "http://localhost:1234/AccountService";

ServiceHost serviceHost = new ServiceHost(
            typeof(AccountService),
            new Uri(serviceURL));
serviceHost.AddServiceEndpoint(
            typeof(IAccountService),
            new BasicHttpBinding(BasicHttpSecurityMode.None),
            "");

serviceHost.Open();
服务的接口位于共享的类库中:

using Common.Types;
using System.ServiceModel;

namespace Common.Interfaces
{
    [ServiceContract]
    [ServiceKnownType(typeof(UserAccountResult))]
    public interface IAccountService
    {
        [OperationContract]
        UserAccountResult Login(string userName, string password);

        [OperationContract]
        UserAccountResult CreateAccount(string userName, string password);
    }
}
UserAccountResult是一个枚举

服务器的控制台应用程序也有接口的实现:

using Common.Types;

namespace Server
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class AccountService : IAccountService
    {
        public UserAccountResult CreateAccount(string userName, string password)
        {
            return UserAccountResult.UserNameTaken;
        }

        public UserAccountResult Login(string userName, string password)
        {
            return UserAccountResult.CannotConnectToServer;
        }
    }
}
对于客户端:

const string serviceURL = "http://192.168.6.139:1234/AccountService";

ChannelFactory<IAccountService> channelFactory =
                new ChannelFactory<IAccountService>(
                new BasicHttpBinding(BasicHttpSecurityMode.None),
                new EndpointAddress(serviceURL));

IAccountService myService = channelFactory.CreateChannel();
const字符串服务URL=”http://192.168.6.139:1234/AccountService";
渠道工厂渠道工厂=
新渠道工厂(
新的BasicHttpBinding(BasicHttpSecurityMode.None),
新端点地址(serviceURL));
IAccountService myService=channelFactory.CreateChannel();
现在,服务器exe正在VMware Workstation 12 Player(使用Windows 10)上运行。 当我尝试使用托管VMware的同一台计算机(但不是从VMware本身)连接到服务器时,连接会起作用,我会得到响应。 但是,当我尝试连接同一网络上的另一台计算机(同一WIFI连接)时,它失败了,我得到一个错误,即没有端点侦听。 我必须从两台不同的计算机连接工作,这是我的第一个学位项目,所以任何帮助将不胜感激

编辑: 因此,我不是在VMware上运行服务器,而是在没有VMware的计算机上运行服务器。然后我从ipconfig获得ip,很明显这是一个动态ip,但当我尝试从另一台计算机连接到它时,它工作正常。 那么我做错了什么?
我可以在VMware和托管它的计算机之间建立连接。我可以在两台计算机之间建立连接,但我似乎无法在VMware与托管它的计算机之间建立连接。

1234是一个奇怪的端口,您可能应该添加防火墙规则它与端口80不起作用,或者一个规则仍然不起作用。。