从 web.config 读取的服务堆栈在生产构建中失败
servicestack read from web.config fails in production build
我需要从 web.config
中读取值
IAppSettings appSettings = new AppSettings();
var slackWebHookUrl = appSettings.Get<string>("slackWebHookUrl");
在开发条件下它可以工作。但是在我 运行 dotnet publish 并尝试启动应用程序之后,它不再可以提供来自 web.config
的值
检查以确保该 App 具有读取 web.config 的读取权限。
ServiceStack 使用以下方法推断 web.config 的路径:
var webConfigPath = Platform.Instance.GetAppConfigPath();
确保它可以被阅读:
var xml = File.ReadAllText(webConfigPath);
我需要从 web.config
中读取值IAppSettings appSettings = new AppSettings();
var slackWebHookUrl = appSettings.Get<string>("slackWebHookUrl");
在开发条件下它可以工作。但是在我 运行 dotnet publish 并尝试启动应用程序之后,它不再可以提供来自 web.config
的值检查以确保该 App 具有读取 web.config 的读取权限。
ServiceStack 使用以下方法推断 web.config 的路径:
var webConfigPath = Platform.Instance.GetAppConfigPath();
确保它可以被阅读:
var xml = File.ReadAllText(webConfigPath);