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

Akhil Fernandez 0 Reputation points
2023-05-24T09:33:31.4566667+00:00

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.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,399 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,193 questions
C#
C#
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.
10,285 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Zhi Lv - MSFT 32,016 Reputation points Microsoft Vendor
    2023-05-25T07:36:30.76+00:00

    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,

    Dillion

    0 comments No comments

  2. Bruce (SqlWork.com) 56,771 Reputation points
    2023-05-25T14:37:20.2233333+00:00

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

    https://devblogs.microsoft.com/dotnet/corewcf-v1-released/

    0 comments No comments