dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.59k stars 9.79k forks source link

Host grpc service in iis or as an app service? #9020

Closed moodya closed 1 year ago

moodya commented 5 years ago

Aug 2022 Update

You can use this issue to track app service progress and follow up about gRPC on app service for Windows.


Original issue:

Is it possible to do this? If so how?


2022/08/18 Update - @JamesNK

Available in most regions: https://azure.github.io/AppService/2022/08/16/A-Heavy-Lift.html πŸ₯³


2022/05/23 Update - @JamesNK

Azure App Service supports gRPC (preview): https://azure.github.io/AppService/2022/05/23/gRPC-support-on-App-Service.html πŸŽ‰


2021/12/16 Update - @JamesNK

User voice issue

~There is a Microsoft Azure user voice issue for adding gRPC support to App Service. Consider voting if this is an important feature for you.~

Azure no longer uses user voice.

2020/10/28 Update - @JamesNK

User voice issue

~There is a Microsoft Azure user voice issue for adding gRPC support to App Service. Consider voting if this is an important feature for you.~

Azure no longer uses user voice.

gRPC-Web

gRPC-Web with .NET is now available. gRPC-Web is compatible with IIS and Azure App Service. Link to blog post with more info: https://devblogs.microsoft.com/aspnet/grpc-web-for-net-now-available/

IIS

IIS is supported with .NET 5 and an insiders build of Windows. More info: https://github.com/dotnet/aspnetcore/issues/9020#issuecomment-713738181

Eilon commented 5 years ago

Hi @moodya , have you checked out the docs at https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-3.0&tabs=visual-studio ?

If you're running into a problem, please let us know and we can investigate.

moodya commented 5 years ago

Yeah I've already built a service that's running as a generic hosted service. I've ported it to the new asp net core 3 template and got it working running on self hosted kestrel, but currently looking at hosting it behind iis and hopefully deploying it as an app service in Azure. I can't get the former (iis) to work.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Eilon Lipton notifications@github.com Sent: Wednesday, April 3, 2019 6:06:17 PM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

Hi @moodyahttps://github.com/moodya , have you checked out the docs at https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-3.0&tabs=visual-studio ?

If you're running into a problem, please let us know and we can investigate.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-479575937, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlUvPONL4H1tZ-pHOakDspdkXLLgThWbks5vdN-JgaJpZM4cZ2SG.

moodya commented 5 years ago

I can't find any examples of how to do this, so maybe it's not supported yet

Get Outlook for Androidhttps://aka.ms/ghei36


From: Alain Moody alainmoody@hotmail.com Sent: Wednesday, April 3, 2019 6:11:06 PM To: aspnet/AspNetCore; aspnet/AspNetCore Cc: Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

Yeah I've already built a service that's running as a generic hosted service. I've ported it to the new asp net core 3 template and got it working running on self hosted kestrel, but currently looking at hosting it behind iis and hopefully deploying it as an app service in Azure. I can't get the former (iis) to work.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Eilon Lipton notifications@github.com Sent: Wednesday, April 3, 2019 6:06:17 PM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

Hi @moodyahttps://github.com/moodya , have you checked out the docs at https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-3.0&tabs=visual-studio ?

If you're running into a problem, please let us know and we can investigate.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-479575937, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlUvPONL4H1tZ-pHOakDspdkXLLgThWbks5vdN-JgaJpZM4cZ2SG.

Eilon commented 5 years ago

@shirhatti - any idea on this?

shirhatti commented 5 years ago

Can't host gRPC in IIS/Azure App Service. The HTTP/2 implementation of Http.Sys does not support HTTP response trailing headers which gRPC relies on.

moodya commented 5 years ago

Thanks for the prompt response. How would you recommend hosting a grpc service in a production scenario at the moment? Also, are you aware of any timescales when a grpc service will be host-able on iis / app service?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Sourabh Shirhatti notifications@github.com Sent: Wednesday, April 3, 2019 7:13:23 PM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

Can't host gRPC in IIS/Azure App Service. The HTTP/2 implementation of Http.Sys does not support HTTP response trailing headers which gRPC relies on.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-479600486, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlUvPNHH4-HhNsSAtugTw0MzzNco6c76ks5vdO9DgaJpZM4cZ2SG.

shirhatti commented 5 years ago

The recommended approach is to host your gRPC service on AKS.

As far as App Service timelines go, I'd defer to @stefsch

moodya commented 5 years ago

Thanks for getting back to me. In terms of aks Vs service fabric in terms of hosting the grpc service is aks the better choice? If so, why?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Sourabh Shirhatti notifications@github.com Sent: Monday, April 8, 2019 7:31:45 AM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

The recommended approach is to host your gRPC service on AKS.

As far as App Service timelines go, I'd defer to @stefschhttps://github.com/stefsch

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-480701227, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlUvPLwQW8HCp-YXsz6yNaK_RH7jbZzWks5veuJRgaJpZM4cZ2SG.

alustrement commented 5 years ago

I'm currently expecting issues to do this. I got a gRPC service running well using aspnetcore 3 preview 3 and Kestrel. But, an error about trailers appears using IIS when the service send the response (the request is well received) : gPRC error => 2 UNKNOWN: No status received) Dotnet error => "Trailers are not supported for this response" in Microsoft.AspNetCore.Http.ResponseTrailerExtensions.AppendTrailer(HttpResponse response, String trailerName, StringValues trailerValues) at Grpc.AspNetCore.Server.Internal.HttpResponseExtensions.ConsolidateTrailers...

moodya commented 5 years ago

As per messages above don't think iis supports hosting a grpc service

Get Outlook for Androidhttps://aka.ms/ghei36


From: alustrement notifications@github.com Sent: Thursday, April 25, 2019 10:57:42 AM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

I'm currently expecting issues to do this. I got a gRPC service running well using aspnetcore 3 preview 3 and Kestrel. But, an error about trailers appears using IIS when the service send the response (the request is well received) : gPRC error => 2 UNKNOWN: No status received) Dotnet error => "Trailers are not supported for this response" in Microsoft.AspNetCore.Http.ResponseTrailerExtensions.AppendTrailer(HttpResponse response, String trailerName, StringValues trailerValues) at Grpc.AspNetCore.Server.Internal.HttpResponseExtensions.ConsolidateTrailers...

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-486607635, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJKS6PEAJ2UKKH2QIKNTCZDPSF6BNANCNFSM4HDHMSDA.

alustrement commented 5 years ago

Following this exchange https://forums.iis.net/p/1241598/2147837.aspx?p=True&t=636917571046786374, it seems that is not the responsibilty of the web server to handle gRPC. gPRC use HTTP/2, IIS supports HTTP/2, so it must works. If it's not, it's a bug from IIS or, more possible, from dotnetcore.

moodya commented 5 years ago

According to do the Microsoft guys in the messages above iis doesn't support the trailing headers required to host a grpc service. This means you can't host one in iis or as an app service at the moment.

Get Outlook for Androidhttps://aka.ms/ghei36


From: alustrement notifications@github.com Sent: Thursday, April 25, 2019 11:39:08 AM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

Following this exchange https://forums.iis.net/p/1241598/2147837.aspx?p=True&t=636917571046786374, it seems that is not the responsibilty of the web server to handle gRPC. gPRC use HTTP/2, IIS supports HTTP/2, so it must works. If it's not, it's a bug from IIS or, more possible, from dotnetcore.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-486620151, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJKS6PBQO4427EYN67SI7A3PSGC4ZANCNFSM4HDHMSDA.

alustrement commented 5 years ago

Thanks, I missed it and it makes sense with my issue. @shirhatti the support is planned on the roadmap ?

shirhatti commented 5 years ago

We (IIS) are currently evaluating whether to support HTTP response trailers. No roadmaps/commitments I can speak to yet.

jbrantly commented 5 years ago

@shirhatti Given gRPC seems to be a major feature of .NET Core 3 (https://github.com/grpc/grpc-dotnet), it would be a real shame if it's not hostable in IIS/App Service given so many .NET web applications are hosted on those. I hope the availability of that feature in .NET Core helps drive your roadmap.

Misiu commented 5 years ago

I fully agree with @jbrantly. gRPC is advertised as one of the main features of .NET Core 3. It should be hostable in IIS/Azure App Services. @shirhatti please consider adding this to the roadmap

moodya commented 5 years ago

I also agree.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Tomasz Jagusz notifications@github.com Sent: Friday, April 26, 2019 9:42:58 AM To: aspnet/AspNetCore Cc: moodya; Mention Subject: Re: [aspnet/AspNetCore] Host grpc service in iis or as an app service? (#9020)

I fully agree with @jbrantlyhttps://github.com/jbrantly. gRPC is advertised as one of the main features of .NET Core 3. It should be hostable in IIS/Azure App Services. @shirhattihttps://github.com/shirhatti please consider adding this to the roadmap

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9020#issuecomment-486977989, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJKS6PENWT46GCJ7GQGEGPTPSK6BFANCNFSM4HDHMSDA.

aloisdeniel commented 5 years ago

I couldn't agree more.

davidfowl commented 5 years ago

We're looking into it. It requires both Windows kernel changes and IIS changes.

Misiu commented 5 years ago

@davidfowl will this be possible when .NET Core 3 is released? Ability to host GRPC in App Services is a blocker for me.

vasquezjames commented 5 years ago

Well is May 29 of 2019, and yet there is not signal that this will be possible. I'm looking for host a GRPC service in IIS and add a certificate to use HTTPS :(

davidfowl commented 5 years ago

No it's not possible on IIS, we're working on getting changes but it will be a slow process (as it requires a windows update).

anisite commented 4 years ago

I roughly lost about 3 days... thanks iis

ahmagdy commented 4 years ago

Hi @davidfowl Any update?

Misiu commented 4 years ago

@davidfowl any chance this might get added before .NET Core 3.0 gets released? Or should we wait for 3.1 or 5.0?

davidfowl commented 4 years ago

No as it requires windows changes. It’s not going to be part of 3.0 and it will require the latest version of Windows (whatever that is at the time) to get these features. There’s no ETA

oising commented 4 years ago

Hmm, I'm in the middle of planning a service fabric implementation that is going to be using gRPC based stateless services and reliable actors, on top of dotnet core 3. Is this going to bite me in the ass? If I host on SF, I guess I'm going to be using kestrel at the core? Time to prototype.

codymullins commented 4 years ago

@oising same boat here - but we're slowly rolling towards k8s + linux containers, so this kind of helps push us that way anyhow.

ikcore commented 4 years ago

I'm just plus 1'ing this as I have been playing around with gRPC now for a while and want to finally start adopting it in some my client projects so was looking at deployment work flows. I'm a little disheartened by the amount of operational overhead this would be to deploy in production with .net core.

jordy-falcon commented 4 years ago

Also took me days to figure out IIS was the problem. Really looking for a fix. Any workarounds?

Misiu commented 4 years ago

@bingoo without Windows support and IIS You are out of luck. You can use Service Fabric but I have no experience with it. I hope that it will be possible to host it on IIS or in Azure in a simple way. For current projects Grpc isn't an option for me because of this issue.

jbomhold3 commented 4 years ago

Would be nice if this was a big bold warning on the docs...

EdiWang commented 4 years ago

IIS hosting isn't supported yet. App Services do use Windows Server 2016 + IIS as it's backend by default, but now it also supports Linux / Containers. If you just want to deploy GRPC on Azure App Service, you can do it now with a Linux Container. But the App Service Plan can't be shared with a Windows hosting plan. You will need to spend extra money for a new App Service Plan backed by Linux Container.

SeanChristopherConway commented 4 years ago

The best way is to use AKS then use Ambassador. Ambassador is an Envoy based api gateway that runs as a container inside Kubernetes. It allows you to proxy both grpc and grpc-web, eg. browser to grpc server and also a grpc client, perhaps a c# one to a grpc server. If you want frontend js to receive gRPC calls you need grpc web and a proxy because browsers also do not support the http2 response trailing headers properly. Grpc Web uses Envoy by default so that is why Ambassador is best.

shirhatti commented 4 years ago

If you just want to deploy GRPC on Azure App Service, you can do it now with a Linux Container

@EdiWang This is currently not supported on App Service for Linux. We are currently working with App Service to enable this, but I don't have any ETA to share

GoranHalvarsson commented 4 years ago

Hello good people Im a bit confused, so we cant have grpc service in azure. But azure itself is using grpc, the Azure Functions Languge Worker Protobuf. https://github.com/Azure/azure-functions-language-worker-protobuf Or am I missing something here? Trying to understand :confused:

markrendle commented 4 years ago

@GoranHalvarsson You can have gRPC services in Azure, you just can't run them in Azure App Services yet.

GoranHalvarsson commented 4 years ago

@markrendle Thanks for answering. So how can I use/setup a gRpc service in Azure?

oising commented 4 years ago

Would be nice if this was a big bold warning on the docs...

https://github.com/aspnet/AspNetCore.Docs/issues/14684

oising commented 4 years ago

@markrendle Thanks for answering. So how can I use/setup a gRpc service in Azure?

By not using IIS, which means using Service Fabric, or AKS - both using raw Kestrel. SF and AKS have different characteristics. Google for "Service Fabric vs AKS" and grab a big coffee.

rupeshtech commented 4 years ago

I have created step by step guide to create test and deploy grpc service using .NET Core 3.0 https://github.com/rupeshtech/k8s-grpc-dotntecore

ikemtz commented 4 years ago

I just looked into this issue, so I haven't tried anything yet; but has anyone tried using Azure Web App for (Container https://azure.microsoft.com/en-us/services/app-service/containers/)?

I'm running a bunch of docker based microservices on Azure App Services and have had very little issues and have allowed me to work around other limiting characteristics of the OOB App Service offering.

thestamp commented 4 years ago

@ikemtz gRPC works when using kestral (ie: when running in containers).

@rupeshtech Thank you, but your article is not related to the issue.

This issue is for hosting gRPC (or any app using trailing headers) in IIS or Azure App Service.

thestamp commented 4 years ago

Would be nice if this was a big bold warning on the docs...

aspnet/AspNetCore.Docs#14684

This is now implemented.

searus commented 4 years ago

@ikemtz I've attempted to run a basic test for using gRPC in a Linux container running in a Azure Web App for Containers and it wouldn't work for me. Couldn't find any errors reported anywhere, but the container wouldn't even respond to HTTP pings. It's a shame. I'm not prepared to move to AKS just to get this functionality, so I guess I'll stick with good old fashioned HTTP services for now.

GoranHalvarsson commented 4 years ago

@searus if you use a virtual machine instead(running in azure)

searus commented 4 years ago

@GoranHalvarsson I'm not prepeared to move from PaaS to IaaS just to make use of this technology. I'll just wait until Azure App Service can support this.

rizamarhaban commented 4 years ago

@davidfowl Any roadmap on this?

ikcore commented 4 years ago

Deploying to a container using Kestral is fine but its the ease of say using Lets Encrypt in IIS or an app service that's really holding me back. If there are any concise guides on how to run a custom domain with lets encrypt on kestrel in a container then I'm jumping into gRPC head first else it's very tough to justify the overhead of creating some custom deployment just to accommodate the new stack.

On Wed, Oct 16, 2019 at 6:46 AM Russell Seamer notifications@github.com wrote:

@GoranHalvarsson https://github.com/GoranHalvarsson I'm not prepeared to move from PaaS to IaaS just to make use of this technology. I'll just wait until Azure App Service can support this.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aspnet/AspNetCore/issues/9020?email_source=notifications&email_token=AMNAZYUWLYLGC5ZGB4GAFITQO2TCFA5CNFSM4HDHMSDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBLFDDI#issuecomment-542527885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNAZYTKUYYBWKSW6AMQDHTQO2TCFANCNFSM4HDHMSDA .

mjtpena commented 4 years ago

With this, Azure Functions and anything else that sits on top of App Service can't really use gRPC and HTTP/2. A timeline would be nice, even for private/public previews.