DEV Community

Cover image for Running Azure Functions in IIS

Running Azure Functions in IIS

gjcampbell on July 20, 2020

Have you ever wanted to run Azure Functions in IIS? No? "Why would you want to run serverless functions in IIS," you ask. I won't try to answer wh...
Collapse
 
icyfire0573 profile image
icyfire0573

Building on your article, I went through this myself and ran into a bunch of issues. I tried to put it all together in this github GIST. Talks about what to install and common trooubleshooting issues
gist.github.com/icyfire0573/f1ad10...

Collapse
 
jakenuts_6 profile image
jakenuts ✊🏽🌎❀️πŸ”₯

I’m pretty sure 90% of Azure is IIS awkwardly canvassed by disgruntled SharePoint devs.

So, after a long & costly β€œmove it all to app services” experiment, I’m going back to my VM and unadulterated IIS - but what to do with the darn functions was an open question, thanks for the info!

Collapse
 
hariss profile image
Hariss07

Whenever I publish azure function its not generating IIS.deps.json config file for me. Correct me if I'm wrong, I believe my function app is not running due to missing of that config file. If I miss any configuration please guide me.

Collapse
 
ductranit profile image
ductranit

Thanks for your great article.
I tried your setup and get the web.config error "The requested page cannot be accessed because the related configuration data for the page is invalid"
I pointed to correct path to Microsoft.Azure.WebJobs.Script.WebHost.exe
Do you have any idea for it?

Collapse
 
gjcampbell profile image
gjcampbell

Yes! You might need to install ASP.NET Core Runtime Hosting Bundle

hosting bundle

Collapse
 
jakenuts_6 profile image
jakenuts ✊🏽🌎❀️πŸ”₯

As I pull back from expensive & slow app service plans to a VM this is a godsend. Have my functions running in IIS without a hitch. I tried making them scheduled tasks at first (mostly timer based) but this is 100% easier especially in deployment. Deploying a local service or scheduled task required lots of extra work, but Devops IIS WebApp deployment is a treat.

Collapse
 
psaillesh profile image
Saillesh pawar

This is amazing, never ever thought of running an Azure function in IIS.

Collapse
 
abdmabdullah profile image
abdmabdullah

Great article. I used this tutorial to set up Azure functions on IIS.

However, now I'm unable to use them with my Blazor application, because CORS apparently isn't working. Did you encounter something like this or do you have any idea how to handle this in IIS?

Collapse
 
ankitjain0906 profile image
ankitjain0906

What if a function app has Authorizationlevel set as Function. The call from postman will fail. Anyway to handle this.
Sorry if this question is weird, I am comparatively new to function app. I know that there needs to be a key to call function apps with Auth level other than Anonymous but don't know where to get and set that key to be able to work with IIS

Collapse
 
pavanpillay profile image
pavankumarsrinivas

Did you get any ways to handle this one with AuthorizationLevel.Function ?

Collapse
 
pavanpillay profile image
pavankumarsrinivas

Hello,

I followed the same steps and i am able to run the function app but when i create new function and run, i am not getting the results.

Image description

When i try to run the same from visual studio, i get the response. any idea if i am missing anything here ?

Collapse
 
psaillesh profile image
Saillesh pawar

I just tried running my timer trigger azure function and followed the steps mentioned above. but I am getting Function host is not running.
Any idea about this error and root cause.

Collapse
 
manjerekarrao profile image
manjerekarrao

the azure function is running as expected locally. however, i'm not able to see those logs

Collapse
 
manjerekarrao profile image
manjerekarrao

i tried adding a ServiceBusTrigger and deployed it locally.

But i see that the function is not running.

erro - Function host is not running.

Collapse
 
thescifibrarian profile image
Danielle Mayabb

I'm having the same issue. My function will run locally, but the function host won't run on IIS. I've tried downloading different versions of it, as well as various versions of the .NET hosting bundle (3.1, 5, 6). No luck. Did you ever solve?

Collapse
 
themajix profile image
Majid Shams • Edited

Nice article, thank you. You can find a web.config file having almost the same contents in Azure, inside this folder: "D:\Program Files (x86)\SiteExtensions\Functions\3.0.14251\64bit":

Collapse
 
sagar_narkar_80189b74f96c profile image
Sagar Narkar

I just tried running my timer trigger azure function and followed the steps mentioned above. But Timer trigger not getting executed in IIS. Please Help

Collapse
 
andreabnm13 profile image
Andrea • Edited

I followed the article, but something doesn't work for me. I can browse to the landing page, but the endpoint are unreachable. What can I check out?

Collapse
 
andreabnm13 profile image
Andrea

SOLVED: i didn't realized you don't have to deploy all the AzureFunction folder but only the content of the bin folder on the root of the site