Skip to main content

Microsoft Silverlight

Answered Question Fetching Controls On Demand not working when deployed on IISRSS Feed

(0)

puneetpriyadarshi
puneetpr...

Member

Member

28 points

17 Posts

Fetching Controls On Demand not working when deployed on IIS

Hi Guys,

I am fetching a control "Misys.GreenTrader.UI.Static.dll" on demand from the client bin.

 This is the piece of code that i have written to fetch the control and add the GreenTraderConfig() usercontrol in the existing stack panel.

 

 // Fetch the next control
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
client.OpenReadAsync(new Uri("Misys.GreenTrader.UI.Static.dll", UriKind.Relative));

 

  void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            AssemblyPart assemblyPart = new AssemblyPart();
            Assembly asm = assemblyPart.Load(e.Result);
            LoadGreenTraderConfig();
        }

    [MethodImpl(MethodImplOptions.NoInlining)]
        void LoadGreenTraderConfig()
        {
            mainPg_Container.Children.Add(new GreenTraderConfig());
        }

 

 

It works fine with visual studio 2008. But as i deploy it in  IIS 6 it does'nt work, its also not throwing any error.

 

I need an urgent help, as deployment dates are getting closer .

 

Thanks,

Puneet


 

mrjvdveen
mrjvdveen

Participant

Participant

1937 points

366 Posts

Answered Question

Re: Fetching Controls On Demand not working when deployed on IIS

 Have you checked if the file is actually there? Good chance it doesn't even get deployed.

Also I find that this is a risky approach as there very well may be dependencies for this dll that are not loaded. The best way around this would be to package it in a .xap file with it's dependencies and load that.

You can find a blogpost about loading stuff dynamically here and here.

HTH.

-------------
Please mark a post as answer if it answers your question.
Visit my blog: http://jvdveen.blogspot.com
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities