Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
moodya opened this issue Apr 3, 2019 · 256 comments
Open

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

moodya opened this issue Apr 3, 2019 · 256 comments
Milestone

Comments

@moodya
Copy link

@moodya moodya commented Apr 3, 2019

Is it possible to do this? If so how?


2021/12/16 Update - @JamesNK

Azure Container Service can host gRPC services - https://techcommunity.microsoft.com/t5/apps-on-azure-blog/introducing-azure-container-apps-a-serverless-container-service/ba-p/2867265


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: #9020 (comment)

@moodya moodya changed the title Host grpc service in iis? Host grpc service in iis or as an app service? Apr 3, 2019
@Eilon Eilon added the area-grpc label Apr 3, 2019
@Eilon
Copy link
Member

@Eilon Eilon commented Apr 3, 2019

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.

@Eilon Eilon added the question label Apr 3, 2019
@moodya
Copy link
Author

@moodya moodya commented Apr 3, 2019

@moodya
Copy link
Author

@moodya moodya commented Apr 3, 2019

@Eilon
Copy link
Member

@Eilon Eilon commented Apr 3, 2019

@shirhatti - any idea on this?

@shirhatti
Copy link
Contributor

@shirhatti shirhatti commented Apr 3, 2019

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.

@JamesNK JamesNK added this to the Discussions milestone Apr 3, 2019
@moodya
Copy link
Author

@moodya moodya commented Apr 4, 2019

@shirhatti
Copy link
Contributor

@shirhatti shirhatti commented Apr 8, 2019

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

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

@moodya
Copy link
Author

@moodya moodya commented Apr 8, 2019

@alustrement
Copy link

@alustrement alustrement commented Apr 25, 2019

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
Copy link
Author

@moodya moodya commented Apr 25, 2019

@alustrement
Copy link

@alustrement alustrement commented Apr 25, 2019

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
Copy link
Author

@moodya moodya commented Apr 25, 2019

@alustrement
Copy link

@alustrement alustrement commented Apr 25, 2019

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

@shirhatti
Copy link
Contributor

@shirhatti shirhatti commented Apr 25, 2019

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

@jbrantly
Copy link

@jbrantly jbrantly commented Apr 25, 2019

@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
Copy link

@Misiu Misiu commented Apr 26, 2019

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
Copy link
Author

@moodya moodya commented Apr 26, 2019

@aloisdeniel
Copy link

@aloisdeniel aloisdeniel commented Apr 26, 2019

I couldn't agree more.

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Apr 26, 2019

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

@Misiu
Copy link

@Misiu Misiu commented May 22, 2019

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

@vasquezjames
Copy link

@vasquezjames vasquezjames commented May 29, 2019

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
Copy link
Member

@davidfowl davidfowl commented May 29, 2019

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
Copy link

@anisite anisite commented Jun 5, 2019

I roughly lost about 3 days... thanks iis

@ahmagdy
Copy link

@ahmagdy ahmagdy commented Jul 25, 2019

Hi @davidfowl
Any update?

@Misiu
Copy link

@Misiu Misiu commented Aug 14, 2019

@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
Copy link
Member

@davidfowl davidfowl commented Aug 14, 2019

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

@angelyordanov
Copy link

@angelyordanov angelyordanov commented Sep 29, 2021

Hosting grpc service .net 5 in IIS 10 & Windows 11 working fine without grpc web

That's great. Now try Windows Server 2016/2019. No enterprise is going to host a gRPC service on Windows 10/11

Just tested it on the Microsoft Evaluation Center provided Windows Server 2022 VM which is at build 20348.1.fe_release.210507-1500 and IT WORKS. Just keep in mind that IIS currently supports HTTP/2 only over TLS.

@acrigney
Copy link

@acrigney acrigney commented Sep 29, 2021

@mrivero2020
Copy link

@mrivero2020 mrivero2020 commented Nov 1, 2021

It is mind boggling that if you start a project in Visual Studio and search for a project template with the keyword "grpc" the only template that comes up is "ASP.NET Core gRPC Service" (not Web) which looks to have NO support as far as hosting in Azure (am I right?). Why would Microsoft would go to such lengths promoting gRPC, and including NuGet packages to build Grpc services that cannot be deployed to Azure? The documentation we get from Microsoft Support around this issue points us to using grpc-Web, but that is documentation from June 2020. No progress has been made since then?

@JoeSchulte
Copy link

@JoeSchulte JoeSchulte commented Nov 1, 2021

Two and a half years and still no action on this? Why does this not get any attention?

@vzalamea
Copy link

@vzalamea vzalamea commented Nov 2, 2021

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.

@shirhatti will there be an update to Windows Server 2019 to fix http.sys to support trailing headers?

@acrigney
Copy link

@acrigney acrigney commented Nov 2, 2021

@mrivero2020
Copy link

@mrivero2020 mrivero2020 commented Nov 2, 2021

What about using Kestrel on windows app services, or using Linux app services with Apache? Will any of these run grpc natively?

@JohnGalt1717
Copy link

@JohnGalt1717 JohnGalt1717 commented Nov 2, 2021

@mrivero2020 There is exactly 3 ways to host GRPC on Azure right now: VM, Container with direct port and IP, K8s using Nginx or HA as your proxy.

No form of Azure App Service will work. Azure Front Door etc all don't support proxying it either for the same reason. (years later)

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Nov 2, 2021

Now you can use azure container apps 😄

@valdisiljuconoks
Copy link

@valdisiljuconoks valdisiljuconoks commented Nov 3, 2021

No, but seriously ;) @davidfowl - is this the recommended way now to host grpc service?

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Nov 3, 2021

I'll write here what I wrote on the other issue

The .NET team doesn't control when Azure gets updates. People are aware and are working on the problem. We leave this issue open so that people can find information on what others have done in the mean time. When app service supports gRPC, it'll be announced on the app service blog, not on this issue (though we'll point to the blog post on this issue).

Azure container apps (just announced today), should work with gRPC though. I'm not saying it's "The officially recommended way to host gRPC services" but its another option to try out, if you're looking to host a gRPC service on azure.

#9020 (comment) is still pretty accurate WRT hosting gRPC services on Azure.

@acrigney
Copy link

@acrigney acrigney commented Nov 3, 2021

@henriksen
Copy link
Contributor

@henriksen henriksen commented Nov 3, 2021

And container apps would be more expensive than app services?

Not necessarily. It's a different model (serverless) so depending on your app and its usage pattern it could be cheaper, or it could be more expensive. Running an app continuously is roughly comparable to an S1 App Plan. But then it can get cheaper with idle pricing or by scaling down to zero when it's not doing work. If it's intermittent work it could be dead cheap, even free.

@mrivero2020
Copy link

@mrivero2020 mrivero2020 commented Nov 3, 2021

Oner more question. Adding grpc-web to the grpc project as shown here

https://docs.microsoft.com/en-us/aspnet/core/grpc/browser?view=aspnetcore-5.0 titled "Use gRPC in browser apps"

has no impact whatsoever on the "hosting" question. Adding grpc-web to the solution only impacts whether browser based applications can call grpc services directly, right?

@davidfowl
Copy link
Member

@davidfowl davidfowl commented Nov 3, 2021

grpc web doesn't depend on HTTP/2 so it works anywhere.

@JohnGalt1717
Copy link

@JohnGalt1717 JohnGalt1717 commented Nov 3, 2021

grpc web doesn't depend on HTTP/2 so it works anywhere.

... with significantly less efficiency.

But yes, the .net GRPC client implementation will fall back automatically to GRPC-Web if it can't connect fully with regular GRPC. The same is true about the Dart library as well for Flutter.

Which we've leveraged to side step this issue, but it's a VERY significant impact on responsiveness and efficiency.

@mrivero2020
Copy link

@mrivero2020 mrivero2020 commented Nov 3, 2021

I am missing something.

My understanding was that first you create a grpc project (by adding the Grpc.AspNetCore NuGet package). If you want to expose the grpc project to browser applications then you add the Grpc.AspNetCore.Web package and do the proper configuration changes in the startup class. The point of adding grpc web being to expose the grpc services directly to browsers. I mentioned this because we followed the instructions described in the link above to add grpc-web to a project deployed on web apps and "still" does not work.

Are we to understand that by adding grpc-web to a grpc project that alone will make it run from a web app (app services)?

@mrivero2020
Copy link

@mrivero2020 mrivero2020 commented Nov 3, 2021

Finally, since container apps were mentioned above as now supporting grpc services I took a look on azure. To deploy a container app (preview) the options are:

  1. Worskpace (vm)
  2. Microsoft HPC Pack 2012 R2 (vm),
  3. Windows 10 IoT Core Services (Azure service)
  4. Web App (Azure service) --- Is this the same web app that we can't deploy grpc services to if we go the route of app services?
    From the options above, which one will support grpc as of today?

It would be very beneficial if this ASPNET CORE team developed some basic documentation on creating a basic Grpc service AND deploying it to Azure. After all, most of use creating apps with ASPNET CORE technologies look at Azure as the natural hosting solution. But, as far as I can see, there is no documentation that shows how to bring together all these technologies (including hosting).

@JohnGalt1717
Copy link

@JohnGalt1717 JohnGalt1717 commented Nov 3, 2021

I am missing something.

My understanding was that first you create a grpc project (by adding the Grpc.AspNetCore NuGet package). If you want to expose the grpc project to browser applications then you add the Grpc.AspNetCore.Web package and do the proper configuration changes in the startup class. The point of adding grpc web being to expose the grpc services directly to browsers. I mentioned this because we followed the instructions described in the link above to add grpc-web to a project deployed on web apps and "still" does not work.

Are we to understand that by adding grpc-web to a grpc project that alone will make it run from a web app (app services)?

Yes, you create a GRPC project, then add GRPC-Web and then it will work in a browser and .net client apps and dart as 2 examples will automatically fall back if http/2 isn't available or otherwise doesn't connect. It's less than ideal, but works. We did it because we were promised that this would be in production more than a year ago. We finally gave up and put it all in k8s with nginx as the RP.

@takekazuomi
Copy link

@takekazuomi takekazuomi commented Nov 3, 2021

It's a different story from IIS and App Service, but it seems that Azure Container Apps announced by Ignite can be used to host gRPC.
https://www.pulumi.com/blog/azure-container-apps/
https://techcommunity.microsoft.com/t5/apps-on-azure/introducing-azure-container-apps-a-serverless-container-service/ba-p/2867265

Perhaps now we should forget about IIS and App Services.

@valdisiljuconoks
Copy link

@valdisiljuconoks valdisiljuconoks commented Nov 8, 2021

Just took a spin of Container App to run our gRPC service. Probably doing something wrong :D

upstream connect error or disconnect/reset before headers. reset reason: connection termination

@andreasfrosig
Copy link

@andreasfrosig andreasfrosig commented Nov 11, 2021

It's a different story from IIS and App Service, but it seems that Azure Container Apps announced by Ignite can be used to host gRPC. https://www.pulumi.com/blog/azure-container-apps/ https://techcommunity.microsoft.com/t5/apps-on-azure/introducing-azure-container-apps-a-serverless-container-service/ba-p/2867265

Perhaps now we should forget about IIS and App Services.

Have you tried it out? did it work?

@valdisiljuconoks
Copy link

@valdisiljuconoks valdisiljuconoks commented Nov 11, 2021

It's a different story from IIS and App Service, but it seems that Azure Container Apps announced by Ignite can be used to host gRPC. https://www.pulumi.com/blog/azure-container-apps/ https://techcommunity.microsoft.com/t5/apps-on-azure/introducing-azure-container-apps-a-serverless-container-service/ba-p/2867265

Perhaps now we should forget about IIS and App Services.

Have you tried it out? did it work?

One comment up..

@andreasfrosig
Copy link

@andreasfrosig andreasfrosig commented Nov 11, 2021

It's a different story from IIS and App Service, but it seems that Azure Container Apps announced by Ignite can be used to host gRPC. https://www.pulumi.com/blog/azure-container-apps/ https://techcommunity.microsoft.com/t5/apps-on-azure/introducing-azure-container-apps-a-serverless-container-service/ba-p/2867265
Perhaps now we should forget about IIS and App Services.

Have you tried it out? did it work?

One comment up..

Yeah so you did not get it to work, i had hoped @takekazuomi did.
but i see now that he seems to be following your comment, so i guess not.
According to this earlier comment there are a lot of possible approaches, he might have tried an other one:
#9020 (comment)

@valdisiljuconoks
Copy link

@valdisiljuconoks valdisiljuconoks commented Nov 11, 2021

Yeah so you did not get it to work, i had hoped @takekazuomi did. but i see now that he seems to be following your comment, so i guess not. According to this earlier comment there are a lot of possible approaches, he might have tried an other one: #9020 (comment)

We are now running on ACI. BUt of course container app with scaling options would be much nicer approach. now I need to dance with traffic manager to accomplish this.

@andreasfrosig
Copy link

@andreasfrosig andreasfrosig commented Nov 11, 2021

We are now running on ACI. BUt of course container app with scaling options would be much nicer approach. now I need to dance with traffic manager to accomplish this.

Yeah, i have worked very little with ACI, but it does not seem like something i want, but i might be forced to.
This blok got me to search for alternatives, just a bit harder :P
https://blog.tech-fellow.net/2021/01/21/building-real-time-public-transport-tracking-system-on-azure-part-6-packing-everything-up/

@mikeball
Copy link

@mikeball mikeball commented Nov 18, 2021

Just took a spin of Container App to run our gRPC service. Probably doing something wrong :D

upstream connect error or disconnect/reset before headers. reset reason: connection termination

I also was unable to get grpc running on the public app url. I opened an issue asking to clarify how grpc is supported in container apps here microsoft/azure-container-apps#38

UPDATE: Good news, was able to get GRPC running on container apps. See the linked issue for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet