从配置中的特定位置路径获取maxRequestLength值 [英] Get maxRequestLength value from specific location path in config

查看:92
本文介绍了从配置中的特定位置路径获取maxRequestLength值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为不同的位置路径设置了几个不同的maxRequestLengths.如何获取要查找的特定位置路径的值?

I have several different maxRequestLengths set for different location paths. How do I get the value of the specific location path that I am looking for?

这是配置中的内容:

Here is what is in config:

推荐答案

检查一下

using System;
using System.Collections;
using System.Configuration;

class DisplayLocationInfo
{
    static void Main(string[] args)
    {
        Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        ConfigurationLocationCollection myLocationCollection = config.Locations;
        foreach (ConfigurationLocation myLocation in myLocationCollection)
        {
            Console.WriteLine("Location Path: {0}", myLocation.Path);
            Configuration myLocationConfiguration = myLocation.OpenConfiguration();
            Console.WriteLine("Location Configuration File Path: {0}", myLocationConfiguration.FilePath);
        }
        Console.WriteLine("Done...");
        Console.ReadLine();
    }
}

https://msdn .microsoft.com/en-us/library/system.configuration.configurationlocation(v = vs.100).aspx

这篇关于从配置中的特定位置路径获取maxRequestLength值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆