You only need an updated MapGuideDotNetApi if you are using the LocalNativeConnection.
I will upload the updated signed dll files later today (appx 20:00 GMT)

If you cannot wait, the command to sign MapGuideDotNetApi is:
signer.exe -k maestroapi.key -outdir .\out -a MapGuideDotNetApi.dll

Signer.exe and the key is in SVN:
http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Signer/Signer.exe?format=raw
http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/maestroapi.key?format=raw

The bindingRedirect setup is as follows:
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MapGuideDotNetApi" publicKeyToken="f526c48929fda856" />

<!--
                NOTE: href MUST be absolute, alternative is to just rename
the desired version of the file and replace MapGuideDotNetApi.dll

If you choose the rename option, remove the <codeBase> tags below,
                but keep the <bindingRedirect>
            -->
<codeBase version="1.2.0.4103" href="MapGuideDotNetApi-1.2.dll"/>
<codeBase version="2.0.0.2308" href="MapGuideDotNetApi-2.0.dll"/>
<codeBase version="1.0.0.1" href="MapGuideDotNetApi-2.1.dll"/>

<!-- Activate MGOS 1.2, MGEP 2008 -->
<!-- <bindingRedirect oldVersion="2.0.0.2308" newVersion="1.2.0.4103" /> -->

<!-- Activate MGOS 2.0, MGEP 2009 , *default* -->
<!-- <bindingRedirect oldVersion="2.0.0.2308" newVersion="2.0.0.2308" /> -->

<!-- Activate MGOS 2.1, MGEP 2010 -->
<bindingRedirect oldVersion="2.0.0.2308" newVersion="1.0.0.1" />

</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Regards, Kenneth Skovhede, GEOGRAF A/S

On 15-01-2010 09:41, Dejan Gregor wrote:
Kenneth,

I am using the verion 2.1.0.3505 for MapGuideDotNetApi. Where should I set
the version value (newVersion or oldVersion) and is the publicKeyToken still
'f526c48929fda856'?

I am using MGE 2010.

Dejan



Kenneth Skovhede, GEOGRAF A/S wrote:
The "Invalid Stream Header" is a sort-of catch-all exception that happens
when the MapGuide service tries to de-serialize an object, and finds
something it does not expect.
The usual cause of this is the other (unmanaged) binaries.

The MapGuideDotNet.dll file is a thin wrapper that just calls the
unmanaged dll's.

So you can bind .Net to either version of the managed dll, but you MUST
have the correct
unmanaged dll's in the bin folder.

Alternatively, you can fix the binding through the Web.config file:
<configuration>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="MapGuideDotNetApi"
publicKeyToken="f526c48929fda856" />
         <bindingRedirect oldVersion="2.0.0.2308" newVersion="1.2.0.4103"
/>
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
</configuration>

Replace the publicKeyToken and version as you please.

There was a slight change with MgDisposable/MgGuardedDisposable some
time ago.
If you run into that, you have to use the re-bind option described above.

Regards, Kenneth Skovhede, GEOGRAF A/S



MacNair skrev:
We have a Mapguide application developed using MGE 2009’s library.  This
application does most of its work by calling methods from another DLL
called
“MGEUtils.DLL”. This DLL references “MapGuideDotNet.DLL”.

The application works fine on the development machine where MGE is
installed. But on the deployment machine where MapGuide Open Source (MGOS
2.0.2.3011) is installed we are getting a few errors.

Should we recompile the class library “MGEUtils” referencing MGOS’s
MapGuideDotNet.DLL?

The calls made to the methods in MGEUtils to initialize the application
are
throwing a few errors as given under. Note: The function definitions for
these methods are given in Appendix below:

// Initialize the webtier
string sErrMsg = "";
mgeUtils.InitializeWebTier(configPath, sErrMsg);

// Validate the user login and create a session
mgeUtils.InitialiseSession("Anonymous", "", ref sessionId, ref sErrMsg);

Note:  The function definitions for the above calls within MGEUtils are
given at the end of this document.

Errors encounterd are…

CASE I: Placing MGE’s MapGuideDotNet.dll  along with “MGEUtils.DLL”  in
the
application’s bin directory.
Error @ LINE: mgeUtils.InitialiseSession("Anonymous", "", ref sessionId,
ref
sErrMsg);
Error details: OSGeo.MapGuide.MgInvalidStreamHeaderException: Invalid
stream
header exception

CASE II: Placing MGOS ’s MapGuideDotNet.dll  along with “MGEUtils.DLL”
in
the application’s bin directory.
Error @ LINE: mgeUtils.InitializeWebTier(configPath, sErrMsg);
Error details: Could not load file or assembly 'MapGuideDotNetApi,
Version=2.0.0.3202, Culture=neutral, PublicKeyToken=6416a18f8953383b' or
one
of its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)

Any help on this? Sorry for the lengthy mail. Thanks!

Function defintions

public bool InitializeWebTier(string configPath, string csErrMsg)
{
    try
    {
      // Check if the webConfig file exists
      if (!File.Exists(configPath)) { return false; }

      MapGuideApi.MgInitializeWebTier(configPath);
        return true;
     }
     catch (MgConnectionFailedException mge)
     {
        csErrMsg = mge.GetMessage();
        return false;
     }
}
public bool InitialiseSession(string userName, string userPwd, ref string
sessionId, ref string csErrMsg)
{
   try
   {
    // Validate user login
    MgUserInformation userInfo = new MgUserInformation(userName, userPwd);
    MgSite site = new MgSite();
    site.Open(userInfo);

    // Create a session
    sessionId = site.CreateSession();
   }
   catch (MgConnectionFailedException mge)
   {
    csErrMsg = mge.GetMessage();
    return false;
   }

   return true;
}




_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users



-----

Dejan Gregor, MSc
GISc Researcher and Consultant

http://www.linkedin.com/in/dgregor
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to