【发布时间】:2021-11-07 10:58:42
【问题描述】:
WCF 服务托管在使用 .NET Framework 编写的本地 VM 上。我需要在 .NET Core 应用程序中使用它。当我尝试通过 Microsoft WCF Web Service Reference Provider
连接它时继续忽略此消息,我只能看到实现 async 的端点。
现在,如果我尝试调用任何异步方法,我会收到此错误。
这就是我实例化它的方式。
public class MotionSimulatorManager
{
public MotionSimulatorManager()
{
try
{
var uri = "net.tcp://192.168.184.33:8458/MotionSimulator";
var endpoint = new EndpointAddress(uri);
var binding = new NetTcpBinding
{
SendTimeout = new TimeSpan(1, 59, 59),
ReceiveTimeout = new TimeSpan(1, 59, 59),
MaxBufferPoolSize = int.MaxValue,
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
Security = { Mode = SecurityMode.None }
};
_motionSimulatorClient = new MotionSimulatorClient(binding, endpoint);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
public async Task<object> NameSake()
{
try
{
var res = _motionSimulatorClient.EstopAsync(); //error comes at this point.
return res;
}
catch (Exception e)
{
File.WriteAllText("D://CollimatorType.txt", e.StackTrace);
throw;
}
}
}
我该如何解决这个问题?如果需要任何其他详细信息,请告诉我。
提前谢谢..
编辑:
我通过添加使用 WCF 服务并创建我在其他 .NET Core 项目中使用的 .NET Framework 项目的 .NET Framework 项目来引入代理,但是在连接到它时出现此错误。
有人可以帮我吗?
【问题讨论】:
标签: c# .net wcf .net-core .net-framework-version