查看服务器从客户端接收streamReader上的文件的示例。
string key = "UploadSalesFileToServer";
GetValue(key);
被添加到函数中,该函数使用:
private static string GetValue(string name)
{
var fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = System.Web.HttpContext.Current.Server.MapPath("~/Modules/Work/web.config");
var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
string configValue = configuration.AppSettings.Settings[name].Value;
return configValue;
}
在web.config中我使用:
<appSettings>
<add key="UploadSalesFileToServer"
value="1111-fasad-32233-ffdsff"/>
</appSettings>
谁能告诉我这里发生了什么?应用程序设置用于检查正在接收的文件是什么?
答案 0 :(得分:0)
GetValue尝试从配置文件中读取配置文件,该配置文件不完全是应用程序配置,位于相对路径“〜/ Modules / Work / web.config”下的不同目录中