You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IIS中基于托管标识的ServiceBus触发式Azure Function无法启动求助

IIS中基于托管标识的ServiceBus触发式Azure Function无法启动求助

大家好,我现在碰到了一个卡壳的问题:我在IIS上部署了一个由ServiceBus触发的Azure Function,采用托管身份认证,但这个函数始终无法启动,连日志都没输出任何有效信息,访问它的URL时直接显示**"Function host is not running."**。

先给大家看一下我的web.config配置内容:

<configuration>
  <system.webServer>
    <handlers>
      <remove name="aspNetCore" />
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="C:\Program Files\Functions.4.29.1\4.29.1\64bit\Microsoft.Azure.WebJobs.Script.WebHost.exe" stdoutLogEnabled="true" stdoutLogFile="c:\Logs\export\export.DataPublisher\stdout" hostingModel="InProcess">
      <environmentVariables>
        <environmentVariable name="FUNCTIONS_WORKER_RUNTIME" value="dotnet-isolated" />
        <environmentVariable name="AzureFunctionsJobHost__Logging__Console__IsEnabled" value="true" />
        <environmentVariable name="AzureWebJobsDisableHomepage" value="false" />
        <environmentVariable name="AppOptions:FunctionEnabled" value="true" />
        <environmentVariable name="AppOptions:Environment" value="TST" />
        <environmentVariable name="BlobStorage:ManagedIdentityClientId" value="UUID" />
        <environmentVariable name="BlobStorage:AccountUrl" value="https://name.blob.core.windows.net" />
        <environmentVariable name="BlobStorage:CollectorContainerName" value="data" />
        <environmentVariable name="BlobStorage:PublisherContainerName" value="processed-data" />
        <environmentVariable name="ServiceBus:ManagedIdentityClientId" value="UUID" />
        <environmentVariable name="ServiceBus:FullyQualifiedNamespace" value="name.servicebus.windows.net" />
        <environmentVariable name="ServiceBus:CollectorTopic" value="blob-created" />
        <environmentVariable name="ServiceBus:CollectorSubscription" value="blob-created-sub" />
        <environmentVariable name="ServiceBus:PublishTopic" value="data-imported" />
        <environmentVariable name="ServiceBus:MaxRetries" value="5" />
        <environmentVariable name="AZURE_CLIENT_ID" value="UUID" />
        <environmentVariable name="KeyVault:VaultName" value="name" />
        <environmentVariable name="KeyVault:Prefix" value="prefix" />
        <environmentVariable name="AzureWebJobsServiceBus__credential" value="managedidentity" />
        <environmentVariable name="AzureWebJobsServiceBus__clientId" value="UUID" />
        <environmentVariable name="AzureWebJobsServiceBus__fullyQualifiedNamespace" value="name.servicebus.windows.net" />
      </environmentVariables>
    </aspNetCore>
  </system.webServer>
</configuration>

目前我已经做了这些排查:

  • 明明开启了stdout日志,但指定的日志目录里完全没有生成日志文件,我自己在函数代码里写的日志也毫无输出
  • 我有一个同环境下的定时触发Function能正常运行,排除了IIS基础配置的问题

现在我有两个核心怀疑点:

  1. FUNCTIONS_WORKER_RUNTIME设置为dotnet-isolated,但hostingModel是InProcess,这两者是不是存在冲突?毕竟隔离模式和进程内托管模式理论上是不兼容的?
  2. ServiceBus的托管身份配置是否有误?我已经确认这个托管身份的ClientID对应的身份拥有ServiceBus的Owner权限,但会不会是环境变量的命名规则或者配置方式出了问题?

有没有遇到过类似问题的朋友,能给我一些排查思路或者配置修正的建议?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 11:38:03