Of course, before you can read the configuration file and start the channel, make sure that your configuration file is correct. The correct format for dynamic configuration of remoting is:
< 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 >
The Type format is <namespace>. <class>, <Assembly>
The service cannot be started. System. runtime. remoting. remotingexception: "system. Io. filenotfoundexception: the specified file cannot be found. (Exception from hresult: 0x80070002)
In system. configserver. runparser (iconfighandler factory, string filename)
In system. configtreeparser. parse (string filename, string configpath, Boolean skipsecuritystuff)
In system. runtime. remoting. remotingconfighandler. loadconfigurationfromxmlfile (string filename) ", The. config file named xxx.windowsservice.exe. config cannot be read ".
In system. runtime. remoting. remotingconfighandler. loadconfigurationfromxmlfile (string filename)
In system. runtime. remoting. remotingconfighandler. doconfiguration (string filename, Boolean ensuresecurity)
In system. runtime. remoting. remotingconfiguration. Configure (string filename, Boolean ensuresecurity)
In XXXX. windowsservice. srvmain. onstart (string [] ARGs)
In system. serviceprocess. servicebase. servicequeuedmaincallback (object state)
Because my software server is first used as an applicationProgram, And then switch to the Windows service,
So I can confirm myCodeYes. The remoting configuration is also correct.
Later I used a Windows File Reading tool and found a record in it.
Createfile
C: \ windows \ system32 \ happyweb.windowsservice.exe. config
Name not found
I guess whether the configuration file is to be put here.
However, I cannot find such results on Google,
The prompt on the internet is that the config file must be put together with the EXE file,
I think it may be an example. If you encounter the same strange thing, I hope this will help you.
In addition, I hope that experts can explain why.