.net - 如果所需的 app/web.config 配置设置不存在,最适合抛出的异常是什么?

标签 .net exception configuration web-config app-config

(@tomhollander 在 Twitter 上提问)
如果所需的 app/web.config 配置设置不存在,最适合抛出的异常是什么?

最佳答案

System.Configuration.ConfigurationException

根据MSDN(我添加的重点):

The ConfigurationException exception is thrown if the application attempts to read or write data to the configuration file but is unsuccessful. Some possible reasons for this can include malformed XML in the configuration file, file permission issues, and configuration properties with values that are not valid.

关于.net - 如果所需的 app/web.config 配置设置不存在,最适合抛出的异常是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/770506/

相关文章:

c# - 无法找到或使用 System.Web.Services.dll

c# - 无法获取值(value),因为它已被优化掉

javascript - 如何在 onCall() 函数中抛出 HttpsError 并在 Android 客户端上捕获

c# - 方法重载适用于异常类型吗?

django - 运行PyCharm测试时,如何解决“django.core.exceptions.ImproperlyConfigured:找不到GDAL库”?

visual-studio-2008 - 如何在 Visual Studio 2008 中的测试时更改连接字符串或其他应用程序设置?

java - Log4j2 创建不需要的日志文件

html - 当我在 Sharepoint Webpart 页面设计中编写相同的 Aspx 代码时,为什么会有轻微的变化?

.net - 如何在 .csproj 文件中为 PackageReference 指定 targetFramework?

Android JNI 异常处理