Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.92k stars 441 forks source link

Razor pages and webapi #2557

Open eByte23 opened 6 years ago

eByte23 commented 6 years ago

Hi,

Amazon release functionality in Lambda to enable use of razor pages and webapi as functions. repo here: https://github.com/aws/aws-lambda-dotnet article https://aws.amazon.com/blogs/developer/serverless-asp-net-core-2-0-applications/

Would this be something that would be considered for a feature request and/or pr?

Thanks

dersia commented 6 years ago

Hi Elijah,

I just went through the article. What they are doing here is, using pre-compiled razor pages.

I'd like to know what you'd like to use this for. Especially in an serverless (therefore stateless) environment. Just to understand the usecase here.

Cheers, Sia

Sent from my Windows 10 phone

From: Elijah Batemailto:notifications@github.com Sent: March 19, 2018 5:24 PM To: Azure/azure-functions-hostmailto:azure-functions-host@noreply.github.com Cc: Subscribedmailto:subscribed@noreply.github.com Subject: [Azure/azure-functions-host] Razor pages and webapi (#2557)

Hi,

Amazon release functionality in Lambda to enable use of razor pages and webapi as functions. repo here: https://github.com/aws/aws-lambda-dotnet article https://aws.amazon.com/blogs/developer/serverless-asp-net-core-2-0-applications/

Would this be something that would be considered for a feature request and/or pr?

Thanks

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-functions-host/issues/2557, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABd3pncMYkTR9VkdSuj4rA1IVnANIowUks5tgEwjgaJpZM4SxG6z.

eByte23 commented 6 years ago

Yes sure its using pre compiled razor but it is still running the full app I believe piped through the host class.

Basic use case is for a website that maybe private, or small business user that maybe have a semi complex site that doesnt have large work time and is use by few people but maybe it will be used more people in future.

Thus giving you a very cheap and reliable infrastructure.

eByte23 commented 6 years ago

Also its not just razor pages its webapi as well

SimonLuckenuik commented 6 years ago

Closest I have been from hosting WebAPI is the with the following approach: https://gist.github.com/SimonLuckenuik/2f35167e1df1d9ee82c17e01893e8dbc It does work, but it involves using the Unit TestServer from Microsoft.AspNetCore.TestHost which is obviously not meant to be used in production...

aL3891 commented 6 years ago

Any update on this one? Would be very useful for us

SimonLuckenuik commented 5 years ago

Using Azure Functions V2, I was able to have Razor Pages running properly inside a Functions host using the TestServer approach: http://www.luckenuik.net/hosting-your-aspnet-core-razor-pages-inside-azure-functions/

This is a proof of concept, but if we develop something similar to TestServer of production grade (and proper tooling to ease the job), we should be able to leverage the full power of MVC APIs\Pages inside Azure Functions.

I do understand that Azure Functions is meant to target multiple languages and that this is a .NET only approach, but I believe there is a need for such an approach. Obviously, something built-in Azure Functions would be preferable...

I know there are some people out there against running AspNet Core MVC inside Azure Functions, but the complete discussion around "it will take more memory, increase start-up time and adds overhead" is meaningless in my view, at least for some scenarios:

jovansnevress commented 5 years ago

Helllllp cyber bullying!🤧

Johan Nevress 323-406-0557

On Jan 5, 2019 1:39 AM, "Simon Luckenuik" notifications@github.com wrote:

Using Azure Functions V2, I was able to have Razor Pages running properly inside a Functions host using the TestServer approach: http://www.luckenuik.net/hosting-your-aspnet-core- razor-pages-inside-azure-functions/

This is a proof of concept, but if we develop something similar to TestServer of production grade (and proper tooling to ease the job), we should be able to leverage the full power of MVC APIs\Pages inside Azure Functions.

I do understand that Azure Functions is meant to target multiple languages and that this is a .NET only approach, but I believe there is a need for such an approach. Obviously, something built-in Azure Functions would be preferable...

I know there are some people out there against running AspNet Core MVC inside Azure Functions, but the complete discussion around "it will take more memory, increase start-up time and adds overhead" is meaningless in my view, at least for some scenarios:

-

Startup time: we are already facing Cold Starts today, that's not going away, adding few milliseconds to initialize the MVC stack is irrelevant. With Azure Functions Premium plan, these concerns will be less relevant, I guess.

Execution Cost: No matter how much memory you are using, for some apps it is still cheaper than having an App Service running 24/7.

Ramp-up Cost: It is way cheaper to take the existing knowledge of developers and make them code as usual with MVC Controllers instead of ramping-up with Azure Functions.

Reuse Opportunity: A lot of work was done by different projects to increase the AspNet Core middleware with interesting features (Ex: Authn\Authz), it is a shame that we cannot reuse that work easily with Azure Functions.

Complexity: If you want to run any business application on Azure Functions, you will face complex code that might take longer than 50 milliseconds. It's not true, in my view, that Azure Functions was designed for small projects only, with quick "in and out" only.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-functions-host/issues/2557#issuecomment-451641474, or mute the thread https://github.com/notifications/unsubscribe-auth/AiOzqlMCXs8AOx-o5h4AcFQ6vG_WgjUuks5vAHK6gaJpZM4SxG6z .

martonx commented 3 years ago

Hi is there any news about this feature request? It would be great to host small Asp.Net Core Web API-s with routing in Azure Functions.