< back

如何解决使用SmobilerService部署后,无法读取Appconfig ,以及无法读取frmMain.cs中Main方法

问题

如何解决使用SmobilerService部署后,无法读取Appconfig ,以及无法读取frmMain.cs中Main方法

回答

app.config

  • 方法1:目前可以将项目中的app.config中的内容复制到SmobilerProcess.exe.config(在应用路径下的SmobilerProcess+应用id.exe.config,例如SmobilerProcess5555.exe.config )中

  • 方法2:使用另外一种写法来读取配置文件:Configuration dll = ConfigurationManager.OpenExeConfiguration(currentAssembly.Location);

frmMain.cs

可以把原来的frmMain.cs里Main方法的内容放到MobileGlobal中 相当于MobileGlobal的静态构造函数中执行