I'm trying to use Azure service bus in a .net core 2.0 console application. I've installed the NuGet package and can see System.ServiceModel.Web in the SDK dependencies.
However when I try to add:
using System.ServiceModel;
I get an error stating it's not defined.
I found this tutorial online that does exactly the same: https://www.servicebus360.com/blogs/azure-service-bus-with-dot-net-core/
What am I missing
According to your description, I created my Net Core 2.0 console application to check this issue. As you said, the System.ServiceModel.Web.dll
is provided by Microsoft.NETCore.App as follows:
Use ILSpy and check the Microsoft.NETCore.App 2.0.0 under C:\\Program Files\\dotnet\\shared\\Microsoft.NETCore.App\\2.0.0
, there is no namespace for System.ServiceModel as follows:
Using Azure Service Bus in .Net core console app
For Net Core 2.0, I have referenced Microsoft.Azure.ServiceBus , and both V 1.0.0 and V 2.0.0 could work as expected as follows:
Moreover, for .Net Framework 4.6, you could only reference Microsoft.Azure.ServiceBus 1.0.0.
Yes to get a .net core 2.0 console app working like from the blog [described above][1] https://www.servicebus360.com/blogs/azure-service-bus-with-dot-net-core/
You need to use Microsoft.Azure.ServiceBus nuget
I particularly liked his blog due to setting up the service bus via azure and instructions to newbies in the pub/sub architecture.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.