问题描述

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 azurehttps://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的更多相关文章

  1. 改善Azure App Service托管应用程序性能的几个技巧

    本文介绍了几个技巧,这些技巧可以改善Azure App Service托管应用程序的性能.其中一些技巧是你现在就可以进行的配置变更, 而其他技巧则可能需要对应用程序进行一些重新设计和重构. 开发者都希 ...

  2. 【应用服务 App Service】在Azure App Service中使用WebSocket - PHP的问题 - 如何使用和调用

    问题描述 在Azure App Service中,有对.Net,Java的WebSocket支持的示例代码,但是没有成功的PHP代码. 以下的步骤则是如何基于Azure App Service实现PH ...

  3. Azure Front Door(一)为基于.net core 开发的Azure App Service 提供流量转发

    一,引言 之前我们讲解到使用 Azure Traffic Manager.Azure LoadBalancer.Azure Application Gateway,作为项目的负载均衡器来分发流量,转发 ...

  4. Azure App Service(一)利用Azure DevOps Pipeline 构建镜像,部署应用程序

    一,引言 起因是前两天项目上做测试,需要我把写好的基于.NET 5 的 Web 测试程序作成 Docker 镜像.当我在本地验证完功能后,准备利用 Docker 构建应用程序镜像的时候,发现系统不支持 ...

  5. 如何将Azure DevOps中的代码发布到Azure App Service中

    标题:如何将Azure DevOps中的代码发布到Azure App Service中 作者:Lamond Lu 背景 最近做了几个项目一直在用Azure DevOps和Azure App Servi ...

  6. 【应用服务 App Service】Azure App Service 中如何安装mcrypt - PHP

    问题描述 Azure App Service (应用服务)如何安装PHP的扩展 mcrypt(mcrypt 是php里面重要的加密支持扩展库) 准备条件 创建App Service, Runtime ...

  7. 【应用服务 App Service】当遇见某些域名在Azure App Service中无法解析的错误,可以通过设置指定DNS解析服务器来解决

    问题情形 当访问部署在Azure App Service中的应用返回 "The remote name could not be resolved: ''xxxxxx.com'" ...

  8. 【Azure 应用服务】Azure App Service For Linux 上实现 Python Flask Web Socket 项目 Http/Https

    问题描述 在上篇博文"[Azure 应用服务]App Service for Linux 中实现 WebSocket 功能 (Python SocketIO)"中,实现了通过 HT ...

  9. Linux 下报错:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must解决方案

    一.报错环境:在Linux mint下,前几天还用得很好的的eclipse,今天开机不知为什么这样. Linux 下报错:A Java RunTime Environment (JRE) or Jav ...

随机推荐

  1. Error response from daemon: driver failed programming external connectivity on endpoint mysql3308 (

    Docker启动容器报错. 1. 错误描述 [root@localhost nginx]# docker start mysql3308 Error response from daemon: dri ...

  2. 【进阶之路】定时任务调用平台xxl-job

    大家好,我是练习java两年半时间的南橘,从一名连java有几种数据结构都不懂超级小白,到现在懂了一点点的进阶小白,学到了不少的东西.知识越分享越值钱,我这段时间总结(包括从别的大佬那边学习,引用)了 ...

  3. Cys_Control(二) MButton

    一.添加自定义Button 二.Xaml文件自动关联 Custom Control 取名与资源文件相同加.cs文件将自动关联 Themes文件下Generic.xaml引入该控件,用于对外公布样式 & ...

  4. 速刷git<一> 常用命令记录

    git config  --list 列出配置  --local 对某个仓库有效  --global 对当前用户的所有仓库有效  --system 对系统所有登录用户有效git reset  --ha ...

  5. 小程序editor篇-基本使用图片上传

    今天小程序项目内,要弄一个editor,富文本编辑功能,支持图文并茂,前几天刚好看了小程序的demo应用,刚好看到editor这个东东,那就安排! 官网示例git地址 大概看了下文档,拉下官方示例,看 ...

  6. linux替换项目jar包

    查看服务是否启动,如果启动,则需要根据 pid 停止服务: # ps -ef | grep xxx.jar 杀掉该项目进程 # kill -9 pid号 再次查看进程 # ps -ef | grep ...

  7. vue项目中增加打印功能

    export default function printFile(html) { let userAgent = navigator.userAgent; if ( (userAgent.index ...

  8. JS复习之深浅拷贝

    一.复习导论(数据类型相关) 想掌握JS的深浅拷贝,首先来回顾一下JS的数据类型,JS中数据类型分为基本数据类型和引用数据类型. 基本数据类型是指存放在栈中的简单数据段,数据大小确定,内存空间大小可以 ...

  9. STL——容器(List)list 的赋值操作

    list.assign(beg, end); //将[beg, end)区间中的数据拷贝赋值给本身 1 #include <iostream> 2 #include <list> ...

  10. tengine下载和安装

    tengine简介: Tengine所基于开发的Nginx的意思是Engine-X,Tengine在淘宝开发,所以我们把Engine-X中的X替换成Taobao.Tengine即Taobao-Engi ...