all groups > dotnet remoting > september 2005 >
You're in the

dotnet remoting

group:

problem with RemotingConfiguration.Configure


problem with RemotingConfiguration.Configure Morix
9/21/2005 12:00:00 AM
dotnet remoting:
I all.
Here's my code:

---
RemotingConfiguration.Configure("myapp.exe.config");
---

The file myapp.exe.config resides in the same directory of myapp
executable and is as follows:

---
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="MyApp">
<service>
<wellknown mode="Singleton" type="MyDLL.DManagerImpl,MyDLL"
objectUri="DManager" />
</service>
<channels>
<channel
type="System.Runtime.Remoting.Channels.Tcp.TcpChannel,System.Runtime.Remoting"
port="8080" />
</channels>
</application>
<debug loadType="true" />
</system.runtime.remoting>
</configuration>
---

When I run the application I obtain an error like:

---
Failed to configure host web service: Impossibile leggere il file
..config MyApp.exe.config a causa dell'eccezione
System.IO.FileNotFoundException: Impossibile trovare il file specificato.
at System.IConfigHelper.Run(IConfigHandler factory, String fileName)
at System.ConfigTreeParser.Parse(String fileName, String configPath,
Boolean skipSecurityStuff)
at
System.Runtime.Remoting.Activation.RemotingXmlConfigFileParser.ParseConfigFile(String
filename)
at
System.Runtime.Remoting.RemotingConfigHandler.LoadConfigurationFromXmlFile(String
filename).
---

[Sorry for the italian: more or less in english is something like:
"Unable to read the .config file MyApp.exe.config due to the exception
System.IO.FileNotFoundException: unable to locate the specified file"]

why? any ideas?
I added a reference to MyDLL assembly in my project, so which file it is
not able to find?

Thanks,
Re: problem with RemotingConfiguration.Configure Morix
9/22/2005 12:00:00 AM
[quoted text, click to view]

Ok, my fault.
The .config file was not in the correct directory.

Bye,
Re: problem with RemotingConfiguration.Configure Roy Chastain
9/22/2005 9:23:59 AM
It can not find the .config file as the message states. This file NORMALLY is in the same directory as the .exe, however you can
put a path in the call to Configure to point to a new directory.

If you have the file in the same directory as the .exe and it is failing, then I would suppose that some code has already changed
the default directory since the program started running.

Suggestion
Pick up the path name of the .exe at run time and use that path in the call to Configure.
Something along this line
RemotingConfiguration.Configure(System.Windows.Forms.Application.ExecutablePath + "\\.config");

If this is zero touch execution of a client from a web server you will need to generate a URI from the path

[quoted text, click to view]
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
AddThis Social Bookmark Button