Remoting Help Required

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi,

I was wondering if anyone could point me in the right direction here.
I've got a remote object that controls the dataset generation for our
system reports. This all works fine at the moment as everything is in
the same directory.

Now I have a request to run multiple versions of the reports on the
single server, i.e. live prod version and latest test version.

The code I currently use is this, although this is cut down.
----------------------------------------------------------------------
If File.Exists(oFileInfo.DirectoryName & "\" & sAssemblyName & ".dll") Then

oAppDomain = AppDomain.CreateDomain(Guid.NewGuid().ToString)
oObjectHandle = oAppDomain.CreateInstance( _
sAssemblyName, _
sAssemblyName & ".cls" & ReportCorrelation & "DataSet", _
False, _
BindingFlags.CreateInstance, _
Nothing, Nothing, Nothing, Nothing, Nothing)

If Not IsNothing(oObjectHandle) Then
oReportDataSet =
oObjectHandle.Unwrap().BuildDataSet(ReportXML, ParametersHashtable,
VariablesHashtable, RuntimeHashtable, BreakGroups)
End If

End If
----------------------------------------------------------------------


The code I'm attemting to change this too is:
----------------------------------------------------------------------
If File.Exists(oFileInfo.DirectoryName & "\" & ReportVersion & "\" &
sAssemblyName & ".dll") Then

oAppDomain = AppDomain.CreateDomain(Guid.NewGuid().ToString,
Nothing, oFileInfo.DirectoryName, "", False)
oAppDomain.AppendPrivatePath(ReportVersion)

oObjectHandle = oAppDomain.CreateInstance( _
sAssemblyName, _
sAssemblyName & ".cls" & ReportCorrelation & "DataSet", _
False, _
BindingFlags.CreateInstance, _
Nothing, Nothing, Nothing, Nothing, Nothing)

If Not IsNothing(oObjectHandle) Then
oReportDataSet =
oObjectHandle.Unwrap().BuildDataSet(ReportXML, ParametersHashtable,
VariablesHashtable, RuntimeHashtable, BreakGroups)
End If

End If
----------------------------------------------------------------------

As you can see, the only real difference here is an expansion of the
CreateDomain call to include a base directory and telling it what
version of the reporting to run.

For some reason the second piece of code results in the following
exception - Public member 'BuildDataSet' on type 'MarshalByRefObject'
not found.

Can anyone help me out here please? I've 'googled' the exception, but
there's not a great deal out there.

Thanks!

Mark
 
The way you're approaching it definitely isn't the easy way. You can use a
..config file, register it as a well known type and as long as it's in the
bin directory of the Remoting Server you're good to go. This means that you
can have the same .dll running on 20 different boxes and have 20 different
instances of your app out there pointing to a separate instance of that dll.
Not saying that you'd want to but I'm just mentioning it for the sake of
illustration.

You don't need to .dll at all on the client machine and by hosting it on a
machine that's running your remoting server as a service or using IIS - then
you can just stick everything there- register it in the config file and
you're gold.


http://www.knowdotnet.com/articles/goingremotei.html
 
W.G. Ryan eMVP said:
The way you're approaching it definitely isn't the easy way. You can use a
.config file, register it as a well known type and as long as it's in the
bin directory of the Remoting Server you're good to go. This means that you
can have the same .dll running on 20 different boxes and have 20 different
instances of your app out there pointing to a separate instance of that dll.
Not saying that you'd want to but I'm just mentioning it for the sake of
illustration.

You don't need to .dll at all on the client machine and by hosting it on a
machine that's running your remoting server as a service or using IIS - then
you can just stick everything there- register it in the config file and
you're gold.


http://www.knowdotnet.com/articles/goingremotei.html


The problem is I'm stuck with this particular monkey on my back, and
can't work out why the almost identical second piece of code doesn't run.

Would you have any pointers or ideas that might explain the two
CreateDomain calls acting differently?

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top