How do I get ServiceHost class (.netframework) in .net 6 c# console application to create a host.

Akhil Fernandez 0 Reputation points

Currently application is running in wcf service with .netframework and its working successfully.

And porting .netframework472 application to .net6 application. and some wcf components/classes can be found in system.servicemodel.primitive.dll

but I couldn't find ServiceHost in any of nuget or dlls ..

Is there any way to get ServiceHost Class and its dependencies in .net6?

Please explain every details.

Microsoft Technologies based on the .NET software framework.
1,162 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
3,159 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,204 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Zhi Lv - MSFT 24,391 Reputation points Microsoft Vendor

    Hi @Akhil Fernandez

    Is there any way to get ServiceHost Class and its dependencies in .net6?

    You can't do it. From the ServiceHost Class, we can see this class is part of the System.ServiceModel namespace that is not supported by .NET Core, just applies to .Net Framework application.

    User's image

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,


    0 comments No comments

  2. Bruce ( 36,261 Reputation points

    While .net core has limited WCF support, and no additional planned, there is community project that has more features.

    0 comments No comments