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

IIS部署.NET服务后Google.Apis.Auth 1.51.0.0程序集加载失败求助

可用解决方案汇总
  • 检查IIS应用程序池配置:打开IIS管理器找到站点对应的应用程序池,进入「高级设置」,首先确认「启用32位应用程序」开关和你项目编译的平台目标一致(Any CPU编译建议保持关闭,x86编译需开启);其次确认应用池没有继承服务器级别的父配置,优先级读取站点根目录的web.config。
  • 修正程序集引用属性:在Visual Studio的后端项目中,展开「引用」节点,逐个选中所有Google相关依赖(Google.Apis、Google.Apis.Core、Google.Apis.Auth、Google.Apis.Auth.PlatformServices),右键打开属性面板,确认「复制本地」属性为True,避免发布时遗漏文件。
  • 补全bindingRedirect配置:你当前的绑定重定向配置缺少必填的publicKeyToken参数,错误信息中已经给出正确的公钥令牌4b01fa6e34db77ab,修改后的配置如下:
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Google.Apis.Auth" culture="neutral" publicKeyToken="4b01fa6e34db77ab" />
            <bindingRedirect oldVersion="0.0.0.0-1.51.0.0" newVersion="1.51.0.0" />
        </dependentAssembly>
        <!-- 其余Google相关依赖也按相同格式补全publicKeyToken配置 -->
        <dependentAssembly>
            <assemblyIdentity name="Google.Apis" culture="neutral" publicKeyToken="4b01fa6e34db77ab" />
            <bindingRedirect oldVersion="0.0.0.0-1.51.0.0" newVersion="1.51.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="Google.Apis.Core" culture="neutral" publicKeyToken="4b01fa6e34db77ab" />
            <bindingRedirect oldVersion="0.0.0.0-1.51.0.0" newVersion="1.51.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="Google.Apis.Auth.PlatformServices" culture="neutral" publicKeyToken="4b01fa6e34db77ab" />
            <bindingRedirect oldVersion="0.0.0.0-1.51.0.0" newVersion="1.51.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>
  • 清理缓存避免旧文件冲突:发布前先清空本地Release编译目录的所有内容,重新编译后再生成发布包;部署到IIS前,先停止站点、删除站点目录下的所有旧文件,再上传新的发布包,避免旧版本程序集残留导致加载冲突。
  • 排查间接依赖冲突:Google.Apis.Auth 1.51.0依赖最低版本为10.0.3的Newtonsoft.Json,确认你项目中引用的Newtonsoft.Json版本符合要求,同时为Newtonsoft.Json添加对应的bindingRedirect配置,解决间接依赖的版本冲突。

内容的提问来源于stack exchange,提问作者Márfi Tamás

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.20 13:24:03