【Azure App Service】C#下制作的网站,所有网页本地测试运行无误,发布至Azure之后,包含CHART(图表)的网页打开报错,错误消息为 Runtime Error: Server Error in '/' Application
问题描述
C#下制作的网站,所有网页本地测试运行无误,发布至Azure之后,包含CHART(图表)的网页打开报错,错误消息为 Runtime Error: Server Error in '/' Application

调查方式
面对C#的黄页错误,最好的做法就是根据提示,关闭C#的自定义错误页面,显示出真正的错误消息。根据提示,在Web.config文件中的system.web节点中添加设置 <customErrors mode="Off"/>
方式有二:
一:进入kudu站点,修改web.config (https://<your web app name>.scm.chinacloudsites.cn/DebugConsole)

二:在源代码中修改web.config,然后重新部署。
再次访问站点,即可得到正在的异常消息:System.IO.DirectoryNotFoundException
|
Invalid temp images directory in chart handler configuration [c:\TempImageFiles\]. Please edit the web.config file. The CharImageHandler key, Dir value must point to a valid directory. The directory is required for temporary image storage when storage mode equals file system. |

根据错误消息,在本地调试时,应用有权限可以直接访问及操作C盘下的目录,而当部署到Azure App Service后,应用对C盘的操作是不可操作的。
解决方案
在web.config中修改ChartImageHandler中对dir路径的设置,修改为d:/home。 如修改前后的值为:
| 修改前ChartImageHandler值 | 修改后ChartImageHandler值 |
| <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /> | <add key="ChartImageHandler" value="storage=file;timeout=20;dir=d:\home\;"/> |
修改后,测试App Serice可以成功访问:

参考资料
File structure on azure: https://github.com/projectkudu/kudu/wiki/File-structure-on-azure
Understanding the Azure App Service file system: https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system
Persisted files
This is what you can view as your web site's files. They follow a structure described here. They are rooted in
%HOME%directory. For App Service on Linux and Web app for Containers, persistent storage is rooted in/home.These files are persistent, meaning that you can rely on them staying there until you do something to change them. Also, they are shared between all instances of your site (when you scale it up to multiple instances). Internally, the way this works is that they are stored in Azure Storage instead of living on the local file system.
【Azure App Service】C#下制作的网站,所有网页本地测试运行无误,发布至Azure之后,包含CHART(图表)的网页打开报错,错误消息为 Runtime Error: Server Error in '/' Application的更多相关文章
- 改善Azure App Service托管应用程序性能的几个技巧
本文介绍了几个技巧,这些技巧可以改善Azure App Service托管应用程序的性能.其中一些技巧是你现在就可以进行的配置变更, 而其他技巧则可能需要对应用程序进行一些重新设计和重构. 开发者都希 ...
- 【应用服务 App Service】在Azure App Service中使用WebSocket - PHP的问题 - 如何使用和调用
问题描述 在Azure App Service中,有对.Net,Java的WebSocket支持的示例代码,但是没有成功的PHP代码. 以下的步骤则是如何基于Azure App Service实现PH ...
- Azure Front Door(一)为基于.net core 开发的Azure App Service 提供流量转发
一,引言 之前我们讲解到使用 Azure Traffic Manager.Azure LoadBalancer.Azure Application Gateway,作为项目的负载均衡器来分发流量,转发 ...
- Azure App Service(一)利用Azure DevOps Pipeline 构建镜像,部署应用程序
一,引言 起因是前两天项目上做测试,需要我把写好的基于.NET 5 的 Web 测试程序作成 Docker 镜像.当我在本地验证完功能后,准备利用 Docker 构建应用程序镜像的时候,发现系统不支持 ...
- 如何将Azure DevOps中的代码发布到Azure App Service中
标题:如何将Azure DevOps中的代码发布到Azure App Service中 作者:Lamond Lu 背景 最近做了几个项目一直在用Azure DevOps和Azure App Servi ...
- 【应用服务 App Service】Azure App Service 中如何安装mcrypt - PHP
问题描述 Azure App Service (应用服务)如何安装PHP的扩展 mcrypt(mcrypt 是php里面重要的加密支持扩展库) 准备条件 创建App Service, Runtime ...
- 【应用服务 App Service】当遇见某些域名在Azure App Service中无法解析的错误,可以通过设置指定DNS解析服务器来解决
问题情形 当访问部署在Azure App Service中的应用返回 "The remote name could not be resolved: ''xxxxxx.com'" ...
- 【Azure 应用服务】Azure App Service For Linux 上实现 Python Flask Web Socket 项目 Http/Https
问题描述 在上篇博文"[Azure 应用服务]App Service for Linux 中实现 WebSocket 功能 (Python SocketIO)"中,实现了通过 HT ...
- Linux 下报错:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must解决方案
一.报错环境:在Linux mint下,前几天还用得很好的的eclipse,今天开机不知为什么这样. Linux 下报错:A Java RunTime Environment (JRE) or Jav ...
随机推荐
- 【NOIP2017提高A组模拟9.17】组合数问题
[NOIP2017提高A组模拟9.17]组合数问题 题目 Description 定义"组合数"S(n,m)代表将n 个不同的元素拆分成m 个非空集合的方案数. 举个例子,将{1,2,3}拆分成2 个 ...
- 单调栈模板 POJ3250
上次二分st表大法失败以后的又一次尝试233333 封装,封装,封装!!!!!! #include <bits/stdc++.h> using namespace std; #define ...
- 第8.18节 Python类中内置析构方法__del__
一. 引言 基本上所有支持OOP设计的语言都支持析构方法(也称析构函数),析构方法都是在对象生命周期结束时调用,一般用来实施实例相关生命周期内访问数据的扫尾工作,包括关闭文件.释放内存.输出日志.清理 ...
- Python基础概念学习遇到的问题
Python运算符的优先级是怎样的? Python中的迭代是什么意思? Python中的列表解析和列表推导是一回事吗? Python中可迭代对象是什么? Python中容器指的是什么? 关于Pytho ...
- 第14.4节 使用IE浏览器获取网站访问的http信息
上节<第14.3节 使用google浏览器获取网站访问的http信息>中介绍了使用Google浏览器怎么获取网站访问的http相关报文信息,本节介绍IE浏览器中怎么获取相关信息.以上节为基 ...
- PyQt(Python+Qt)学习随笔:Qt Designer中spacer部件的orientation属性
在Designer的spacers部件中有2个部件,分别是Horizontal Spacer和Vertical Spacer,这两个部件都有orientation属性,表示Spacer部件的方向. 如 ...
- 从零开始的ssti学习(已填)
前前言: 本文只是接这个机会来梳理一下ssti的知识点.先说一下,本文目前的重点是Flask的ssti,但是之后会填其他框架的坑.(就不该叫ssti学习,ssti太广了) 涉及知识点: 模板注入 前言 ...
- node.js、yarn、npm到底是什么?
最近在部署环境,在没有开发脚本的情况下,自己根据以往其他项目中的脚本去生搬硬套,发现很难对项目的配置成功.对配置不成功的情况进行判断,发现是对脚本不熟悉,不了解其原理,实现方式也不知道,所以抽时间去了 ...
- Java面试专题-多线程(3)-原子操作
- 1、pytorch写的第一个Linear模型(原始版,不调用nn.Modules模块)
参考: https://github.com/Iallen520/lhy_DL_Hw/blob/master/PyTorch_Introduction.ipynb 模拟一个回归模型,y = X * w ...