WebApi.Hosting.TopShelf.Demo icon indicating copy to clipboard operation
WebApi.Hosting.TopShelf.Demo copied to clipboard

Self-Hosting on .NET 4.0

Open Reza-Noei opened this issue 7 years ago • 3 comments

Hi, I want to develop a windows service which can be installed on windows XP also. so I need to force the application to use .NET 4.0 but it seems that TopShelf Self-hosting is working on .NET 4.5 and i don't know how to downgrade.

I know that it may WebApi2 Prerequisite but i want to do that. is it possible ?

Reza-Noei avatar Oct 19 '18 08:10 Reza-Noei

Hi @Reza-Noei,

Topshelf 3 can run on .NET 4.0 but seems like ASP.NET Web API 2 doesn't support .NET 4.0 and I don't know any workarounds for this.

You can try some alternative .NET frameworks for building HTTP APIs like Nancy. It supports .NET 4.0 and there's a nice guide explaining how to self-host it. Then you can integrate it with Topshelf 3 yourself or use this handy library.

Another notable alternative is ServiceStack 4.0.*. It also supports .net 4.0 and can be self-hosted.

Hope this information is helpful.

P.S. I used https://www.fuget.org to determine required versions of .NET framework for mentioned packages.

skazantsev avatar Oct 19 '18 20:10 skazantsev

Thank you @skazantsev,

I was thinking about WCF and It's complexities. but now I have a new way and i will try to learn Nancy and it seems that it can be useful for me.

Reza-Noei avatar Oct 19 '18 22:10 Reza-Noei

Topshelf 3 can run on .NET 4.0 but seems like ASP.NET Web API 2 doesn't support .NET 4.0 and I don't know any workarounds for this. Nancy is no longer maintained. Is it still advisable to use?

What if we use Web API 1?

Kushal5 avatar Jul 07 '20 03:07 Kushal5