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.

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | .NET | Other
Developer technologies | C#
Developer technologies | 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.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    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) 82,061 Reputation points Volunteer Moderator
    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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.