gpt4 book ai didi

c# - ChannelFactory<>.CreateChannel 中的 Mono TypeLoadException,.NET/Windows 上没有异常

转载 作者:太空宇宙 更新时间:2023-11-03 11:30:09 32 4
gpt4 key购买 nike

我正在创建一个基于 net.tcp 的 WCF 服务来控制我们的后端应用程序之一。在 Windows 机器上进行开发和测试期间,一切都按预期进行。但是,当我尝试在同一个 Windows 机器(Mono 2.10.6)或 Debian Squeeze(使用 Mono 2.10.5)上使用 Mono 运行完全相同的应用程序时,我突然在ChannelFactory.

最后归结为这个失败的调用:

controlHost = ChannelFactory<IControlServiceContract>.CreateChannel(
new NetTcpBinding(SecurityMode.None),
new EndpointAddress(endpointAddress)
);

在另一个程序集中为 IControlServiceContract 定义:

[ServiceContract]
public interface IControlServiceContract
{
[OperationContract(IsOneWay = true)]
void Ping ();

[OperationContract(IsOneWay = true)]
void Shutdown ();

[OperationContract]
int GetCommandCount ();
}

直接启动时运行良好(即使用 .NET)。

当使用 mono --debug --runtime=v4.0 执行时,尽管它会因这个超棒的堆栈跟踪而崩溃:

! Ein Fehler ist beim Erzeugen des Kanals auf net.tcp://localhost:34684/watchdog/watchdog.ctrl/ aufgetreten

A type load exception has occurred.
at System.Linq.Enumerable.Union[Object] (IEnumerable`1 first, IEnumerable`1 second, IEqualityComparer`1 comparer) [0x00014] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.Core\System.Linq\Enumerable.cs:2948
at System.Linq.Enumerable.Union[Object] (IEnumerable`1 first, IEnumerable`1 second) [0x00007] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.Core\System.Linq\Enumerable.cs:2938
at System.ServiceModel.Description.ContractDescriptionGenerator.GetOrCreateOperation (System.ServiceModel.Description.ContractDescription cd, System.Reflection.MethodInfo mi, System.Reflection.MethodInfo serviceMethod, System.ServiceModel.OperationContractAttribute oca, System.Type asyncReturnType, Boolean isCallback, System.Type givenServiceType) [0x001f2] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:314
at System.ServiceModel.Description.ContractDescriptionGenerator.FillOperationsForInterface (System.ServiceModel.Description.ContractDescription cd, System.Type exactContractType, System.Type givenServiceType, Boolean isCallback) [0x00131] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:240
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContractInternal (System.Type givenContractType, System.Type givenServiceType, System.TypeserviceTypeForCallback) [0x00296] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:197
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:136
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:131
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type contractType) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescriptionGenerator.cs:101
at System.ServiceModel.Description.ContractDescription.GetContract (System.Type contractType) [0x00017] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel.Description\ContractDescription.cs:66
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract].CreateDescription () [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel\ChannelFactory_1.cs:185
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract]..ctor (System.Type type) [0x00033] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel\ChannelFactory_1.cs:56
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract]..ctor (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory`1[com.derixx.dll.controlservicehost.ServiceBase.IControlServiceContract].CreateChannel (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.6\mcs\class\System.ServiceModel\System.ServiceModel\ChannelFactory_1.cs:130
at applicationframework.ControlApplicationBase.ConnectionCreate (IControlServiceContract& controlHost, System.String endpointHost, Int32 endpointPort, System.String endpointPath) [0x00000] in <filename unknown>:0

他的项目中使用的所有程序集都是我们自己针对 Framework 4.0、核心程序集和 log4net 1.2.10/2.0.50727 的程序集。

有谁知道这可能是什么以及我应该从哪里开始挖掘?

最佳答案

嗯,如果它适用于 .NET 而不是 Mono,那肯定是一个错误。

我会继续,首先在 http://bugzilla.xamarin.com/ 中提交它

然后可能会在 irc://irc.gnome.org/mono 上闲逛,并戳戳 WCF 的维护者 Atsushi Enomoto(昵称“eno”),看看他的想法。

关于c# - ChannelFactory<>.CreateChannel 中的 Mono TypeLoadException,.NET/Windows 上没有异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8070179/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com