remoting作成windows服务后一直无法读取配置文件,可能的原因之一。
2008-06-30 08:59
369 查看
当然在这个无法读取配置文件,无法启动通道之前,你必须确认你的配置文件是正确的。正确的动态配置remoting的格式是:
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown type="HappyWeb.BLL.PublishNewsClass,HappyWeb.BLL" objectUri="HappyWeb.BLL.PublishNewsClass"
mode="Singleton" />
<wellknown type="HappyWeb.BLL.MemberLoginCheck,HappyWeb.BLL" objectUri="HappyWeb.BLL.MemberLoginCheck"
mode="Singleton" />
<wellknown type="HappyWeb.BLL.PublishPartsNews,HappyWeb.BLL" objectUri="HappyWeb.BLL.PublishPartsNews"
mode="Singleton" />
</service>
<channels>
<channel ref="tcp" port="9999">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
里面type的格式是 <namespace>.<class>, <assembly>
无法启动服务。System.Runtime.Remoting.RemotingException: 因发生异常“System.IO.FileNotFoundException: 系统找不到指定的文件。 (异常来自 HRESULT:0x80070002)
在 System.ConfigServer.RunParser(IConfigHandler factory, String fileName)
在 System.ConfigTreeParser.Parse(String fileName, String configPath, Boolean skipSecurityStuff)
在 System.Runtime.Remoting.RemotingConfigHandler.LoadConfigurationFromXmlFile(String filename)”而无法成功读取 .Config 文件“xxx.WindowsService.exe.config”。
在 System.Runtime.Remoting.RemotingConfigHandler.LoadConfigurationFromXmlFile(String filename)
在 System.Runtime.Remoting.RemotingConfigHandler.DoConfiguration(String filename, Boolean ensureSecurity)
在 System.Runtime.Remoting.RemotingConfiguration.Configure(String filename, Boolean ensureSecurity)
在 xxxx.WindowsService.srvMain.OnStart(String[] args)
在 System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
因为我的软件服务端先是做成应用程序,后面才转Windows服务,
所以我可以确认我的代码是没错的,同样REMOTING的配置也是没问题的。
后面用监控WINDOWS文件读取工具,发现里面有一条记录
CreateFile
C:\WINDOWS\system32\HappyWeb.WindowsService.exe.config
NAME NOT FOUND
我猜测着是不是配置文件要放这,想不到还真是。
可是我在GOOGLE上一直搜索不到这种结果,
而网上同学的提示一直是config文件要和exe放在一起,
我想可能是个例吧,如果你也碰到同样的怪事,希望这能帮助到你。
另外也希望高手能解析下为什么。
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown type="HappyWeb.BLL.PublishNewsClass,HappyWeb.BLL" objectUri="HappyWeb.BLL.PublishNewsClass"
mode="Singleton" />
<wellknown type="HappyWeb.BLL.MemberLoginCheck,HappyWeb.BLL" objectUri="HappyWeb.BLL.MemberLoginCheck"
mode="Singleton" />
<wellknown type="HappyWeb.BLL.PublishPartsNews,HappyWeb.BLL" objectUri="HappyWeb.BLL.PublishPartsNews"
mode="Singleton" />
</service>
<channels>
<channel ref="tcp" port="9999">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
里面type的格式是 <namespace>.<class>, <assembly>
无法启动服务。System.Runtime.Remoting.RemotingException: 因发生异常“System.IO.FileNotFoundException: 系统找不到指定的文件。 (异常来自 HRESULT:0x80070002)
在 System.ConfigServer.RunParser(IConfigHandler factory, String fileName)
在 System.ConfigTreeParser.Parse(String fileName, String configPath, Boolean skipSecurityStuff)
在 System.Runtime.Remoting.RemotingConfigHandler.LoadConfigurationFromXmlFile(String filename)”而无法成功读取 .Config 文件“xxx.WindowsService.exe.config”。
在 System.Runtime.Remoting.RemotingConfigHandler.LoadConfigurationFromXmlFile(String filename)
在 System.Runtime.Remoting.RemotingConfigHandler.DoConfiguration(String filename, Boolean ensureSecurity)
在 System.Runtime.Remoting.RemotingConfiguration.Configure(String filename, Boolean ensureSecurity)
在 xxxx.WindowsService.srvMain.OnStart(String[] args)
在 System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
因为我的软件服务端先是做成应用程序,后面才转Windows服务,
所以我可以确认我的代码是没错的,同样REMOTING的配置也是没问题的。
后面用监控WINDOWS文件读取工具,发现里面有一条记录
CreateFile
C:\WINDOWS\system32\HappyWeb.WindowsService.exe.config
NAME NOT FOUND
我猜测着是不是配置文件要放这,想不到还真是。
可是我在GOOGLE上一直搜索不到这种结果,
而网上同学的提示一直是config文件要和exe放在一起,
我想可能是个例吧,如果你也碰到同样的怪事,希望这能帮助到你。
另外也希望高手能解析下为什么。
相关文章推荐
- Windows 不能加载本地存储的配置文件。此问题的可能原因是安全权限不足或本地配置
- Windows 服务多语言化时读取配置文件失败的问题。
- 由于权限不足而无法读取配置文件出现的HTTP 500.19解决办法
- IIS7虚拟目录出现HTTP错误500.19(由于权限不足而无法读取配置文件)的问题
- eclipse 启动服务后,部署的文件一直是旧的文件的原因分析
- 读取web应用中properties配置文件(这种方法可能不是最好的)
- IIS7虚拟目录出现HTTP错误500.19(由于权限不足而无法读取配置文件)的解决方案
- windows下通过配置文件简易安装Mongodb(windows服务安装,权限设置)
- 错误ID:10005,错误信息:DCOM 遇到错误“无法启动服务,原因可能是它被禁用或与它相关联的设备没有启动。 ”,试图以参数“”启动服务 SENS 以运行服务器:
- Untiy3D(4.5) 中应用 MovieTexture,无法关联资源文件可能的原因
- Spring无法读取配置文件信息
- windows 显示smb分享成功,其他电脑却无法读取该分享原因
- 您不具备查看该目录或页面的权限,因为访问控制列表(ACL)对Web服务器上的该资进行了配置-关于IIS新追加文件无法访问的原因
- Windows 无法设置xxx的密码,原因是:工作站服务没有启动 或 密码不满足密码策略的要求
- 关于Windows无法访问指定设备路径或文件,您可能没有合适的权限访问问题解决<转>
- Sybase 15.7 Windows 2008 64位 安配置服务时出错CreateProcess error=14001,sybatch.exe无法执行
- win2003开机有问题:Windows 无法查询 {7B849a69-220F-451E-B3FE-2CB811AF94AE} 的 DllName 注册表项,它将不会被加载。最有可能的原因是注册错误。
- 由于权限不足而无法读取配置文件出现的HTTP 500.19解决办法
- DCOM遇到错误“无法启动服务,原因可能是已被禁用或与其相关联的设备没有启动”的解决
- Windows下VIM使用Vundle,报“E303,无法打开**的交换文件,恢复将不可能”的解决方法