配置文件应该是没问题的,因为同一个文件一个winform的程序就可以顺利的把remoting
开启可windows服务却不行,我把那个配置文件放在服务所在的那个目录里,应该也不会是路径的问题。在服务里的调用代码:
RemotingConfiguration.Configure(@"Service.exe.config");
配置文件:
<configuration>
<appSettings>
<add key="connStr" value="server=192.168.0.111;database=111;uid=sa;pwd=a;"></add>
</appSettings>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" type="CCXX.QBCJFX.Marshalc1, Marshalc1" objectUri="Marshalcs.soap" />
</service>
<channels>
<channel port="8087" ref="http"/>
<channel port="8086" ref="Tcp"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
开启可windows服务却不行,我把那个配置文件放在服务所在的那个目录里,应该也不会是路径的问题。在服务里的调用代码:
RemotingConfiguration.Configure(@"Service.exe.config");
配置文件:
<configuration>
<appSettings>
<add key="connStr" value="server=192.168.0.111;database=111;uid=sa;pwd=a;"></add>
</appSettings>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" type="CCXX.QBCJFX.Marshalc1, Marshalc1" objectUri="Marshalcs.soap" />
</service>
<channels>
<channel port="8087" ref="http"/>
<channel port="8086" ref="Tcp"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
Dim t As Type = Me.GetType
Dim a As System.Reflection.Assembly = t.Assembly
Dim cfg As String = a.Location & ".config"
System.Runtime.Remoting.RemotingConfiguration.Configure(cfg)