问题描述

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. 知识点:C语言进阶提高篇,自定义数据类型:枚举

    一.枚举的概念 枚举是C语言中的一种基本数据类型,并不是构造类型,它可以用于声明一组常数.当一个变量有几个固定的可能取值时,可以将这个变量定义为枚举类型.比如,你可以用一个枚举类型的变量来表示季节,因 ...

  2. Golang 实现 Redis(8): TCC分布式事务

    本文是使用 golang 实现 redis 系列的第八篇, 将介绍如何在分布式缓存中使用 Try-Commit-Catch 方式来解决分布式一致性问题. godis 集群的源码在Github:Godi ...

  3. VMware-workstation-full-10.0.4安装

    1.下载安装包 链接:https://pan.baidu.com/s/1SBd3KP4Nxk-RaHLv7HIYTw 提取码:8zkm 2.安装VMware-workstation 双击安装包 选择典 ...

  4. Redis数据库简介

    最近的项目需要用到Redis数据库和MySQL,恶补学习. Redis的使用手册可以看: https://redis.io/ https://www.runoob.com/redis/redis-tu ...

  5. LeetCode初级算法之数组:26 删除排序数组中的重复项

    删除排序数组中的重复项 题目地址:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/ 给定一个排序数组,你需要在 ...

  6. springboot 导出xlsx文件

    @Override public String downModelXlsFile(SxSourceReq param, HttpServletResponse response) { //设置响应编码 ...

  7. 图论-zkw费用流

    图论-zkw费用流 模板 这是一个求最小费用最大流的算法,因为发明者是神仙zkw,所以叫zkw费用流(就是zkw线段树那个zkw).有些时候比EK快,有些时候慢一些,没有比普通费用流算法更难,所以学z ...

  8. redis学习之——主从复制(replication)

    准备:拥有linux环境,并安装redis mater:主机,进行写操作 slave:从机,进行读操作 一.配置 继续前边的学习.我们是拷贝redis.conf,文件到了/root /redis 下. ...

  9. 零基础学习python 你该怎么做

    本人文科生,回顾自己近 2 年的Python 自学经历,有一些学习心得和避坑经验分享给大家,让大家在学习 Python 的过程中少走一些弯路!减少遇到不必要的学习困难! 首先,最开始最大的困难应该就是 ...

  10. 用列表+for循环生成乘法口诀表

    1 # 结合一下列表生成, 准备设计乘法表 2 # numlist = [1,2,3,4,5] 3 # [pow(i,3) for i in numlist] 4 # ## [1, 8, 27, 64 ...