Is app.config in the same directory as c:\path\to\ir.exe? I'm guessing no. I'm 
NOT saying it should be. I'm saying use the other hosting method I told you to. 
I believe that will use IronRuby's exe.config for IronRuby. If you don't want 
to use my suggestion, then you need to modify the relative paths in your 
app.config to point to the right location.

JD

-----Original Message-----
From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Mohammad Azam
Sent: Monday, March 01, 2010 8:38 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Open-Uri Path in App.Config

Hi,

>> Probably because your app config is in a different location than ir.exe.

Do you mean the ironruby app config or my application app config? My 
application config is in my application directory. The question is that why it 
is not reading my application config automatically.

Thanks,
Azam


Jim Deville wrote:
> Probably because your app config is in a different location than ir.exe.
> 
> Try this. Replace:
> 
> static void Main(string[] args)
>         {
>             var url = "http://www.google.com";;
> 
>             var engine = IronRuby.Ruby.CreateEngine();
> 
>             var paths = new List<String>();
>             paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib");
>             paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\site_ruby\1.8");
>             paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\site_ruby");
>             paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\1.8");
> 
> 
>             engine.SetSearchPaths(paths);
> 
>             engine.ExecuteFile("../../screenscraper.rb");
>             var obj =
> engine.Runtime.Globals.GetVariable("ScreenScraper");
> 
>             var screenScraper = engine.Operations.CreateInstance(obj);
> 
>             var html = engine.Operations.InvokeMember(screenScraper,
> "scrape", url);
> 
>             Console.WriteLine(html);
> 
>         }
> With:
> 
> static void Main(string[] args)
>         {
>             var url = "http://www.google.com";;
>             var setup = ScriptRuntimeSetup.ReadConfiguration();
>             var scriptRuntime = Ruby.CreateRuntime(setup);
>             var engine = Ruby.GetEngine(Runtime);
>             //the following line might not be needed in this case
>              var context = Ruby.GetExecutionContext(Engine);
> 
>             engine.ExecuteFile("../../screenscraper.rb");
>             var obj =
> engine.Runtime.Globals.GetVariable("ScreenScraper");
> 
>             var screenScraper = engine.Operations.CreateInstance(obj);
> 
>             var html = engine.Operations.InvokeMember(screenScraper,
> "scrape", url);
> 
>             Console.WriteLine(html);
> 
>         }

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to