简体   繁体   English

调用QueueClient.CreateFromConnectionString时使用C#的Azure服务总线队列:BadImageFormatException

[英]Azure Service bus Queue using C# : BadImageFormatException when calling QueueClient.CreateFromConnectionString

I am using VS2017 in Mac( with latest packages added for Azure Service Bus), to pull a message from Service bus Queue in Azure. 我在Mac中使用VS2017(已为Azure Service Bus添加了最新软件包),以从Azure中的Service bus Queue中提取消息。 On execution of below code, getting the error 在执行以下代码时,出现错误

BadImageFormatException - could not resolve field token 0x0400089c BadImageFormatException-无法解析字段令牌0x0400089c

Its coming from CreateFromConnectionString and the stack points to MessageFactory.create call which happens under the hood, on our call to CreateFromConnectionString. 它来自CreateFromConnectionString,堆栈指向MessageFactory.create调用,该调用在我们对CreateFromConnectionString的调用的幕后进行。

Got many pointers like x86 issue and all, but none were certain on what to look into. 有很多类似x86问题之类的指针,但都不确定要研究什么。 I was using Release x86, then tried Rel AnyCpu as well. 我使用的是x86版本,然后也尝试了Rel AnyCpu。

Does anyone faced this issue before or any pointers to resolve this. 是否有人之前曾遇到过此问题,还是有解决此问题的指针。

string connectionString = "Endpoint=sb://spxxxx.servicebus.windows.net/;SharedAccessKeyName=Root**Key;SharedAccessKey=xxxx.......xxxxxxxx=";
        string queueName = "spqueue";
        QueueClient client = QueueClient.CreateFromConnectionString(connectionString, queueName);

Also did an trail by creating the MessageFactory in the program itself. 还通过在程序本身中创建MessageFactory进行了跟踪。 Got same error at MessagingFactory.Create 在MessagingFactory.Create上遇到了相同的错误

Also connectionString and queue name are fine, as I am able to generate the Authorization token correctly using this code and postman connected to the Q using the same without any issues. 也可以使用connectionString和队列名称,因为我可以使用此代码正确生成Authorization令牌,并且邮递员可以使用该代码正确地连接到Q,没有任何问题。

Thanks! 谢谢! Let me know if any additional details needs to be added. 让我知道是否需要添加任何其他详细信息。

AFAIK, Visual Studio 2017 for Mac provides the ability for using Xamarin and .NET Core to build mobile,web, and cloud applications on macOS. AFAIK,适用于Mac的Visual Studio 2017提供了使用Xamarin和.NET Core在macOS上构建移动,Web和云应用程序的功能。 Per my understanding, the Microsoft Azure Service Bus 4.1.3 targets on the traditional .NET Framework, you could try to use the next generation Azure Service Bus .NET Standard client library Microsoft.Azure.ServiceBus 0.0.7-preview . 根据我的理解, Microsoft Azure Service Bus 4.1.3以传统的.NET Framework为目标,您可以尝试使用下一代Azure Service Bus .NET Standard客户端库Microsoft.Azure.ServiceBus 0.0.7-preview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM