December 14, 2011

Mapguide 6.5 Server Not Found on Hardened Windows 2008 Server

Filed under: Mapguide — Tags: , , , — Darrin Maidlow @ 11:39 am

It seems I’ve become the “go to guy” when it comes to Mapguide 6.5 on modern platforms!   This post builds on my previous post that documents .  In this edition we look at the situation faced on a clients server.   Basically the installation went off without a hitch with one exception.  When attempting to test the Mapguide 6.5 ISAPI the following error occurred:

HTTP Error 500.19 – Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid

(more…)

November 4, 2011

Introducing Question of the Week for ObjectARX.NET and Mapguide

Filed under: AutoCAD,Development,Mapguide — Tags: , , , — Darrin Maidlow @ 11:32 pm

Every good developer is constantly evolving and learning new technologies.  This can be a challenge when you’re hard at work in maintenance mode on familiar technology or when your every day needs don’t go as deeply into topics as you would like. 

If you take a step back and look at AutoCAD and – its a huge body of work and it is a challenge to get experience in all the various parts of it.  The recent request I received on how to or the command line and the subsequent research, code and blog post I wrote made me think,  what if I solicited small problems from the AutoCAD community that could make fun little 4 hour research projects.  These would allow me to dig into various portions of ObjectARX.NET once a week, write some fun code, and give me things to write about.  Everybody wins!

I’m looking to spend about 4-6 hours on each question.  I’m hoping to do one question per week, assuming I get enough requests.  I’ll provide the full source and project with each post.  All code will be written in c#.  Some examples of valid requests would be:

  • Submit a Visual Lisp routine to convert to ObjectARX.NET.
  • Request a particular routine that does some sort of drawing clean up or modifies something.
  • Identify some functionality that is missing in AutoCAD.
  • Request a piece of sample code explaining how to use API x of ObjectARX.NET or Mapguide Enterprise/Open Source.

The Do’s

  • Please keep your request realistic.   I’ve only got 4 to 6 hours and you’re not paying me =)
  • Please submit specific functionality along with sample data.
  • Please be available to answer any questions  I might have via e-mail, phone/skype or possibly gotomeeting.
  • Please keep the underlying technology somewhat current.  Don’ t request AutoCAD/Mapguide 2007.
  • Please review my code and comment if you see something wrong or that I could do more efficiently.  This is about me learning and I’m gonna make mistakes.

The Don’ts

  • Don’t expect days worth of work, I just don’t have that much spare time.
  • Don’t ask me to work on your project (unless of course you want to hire my team via ).
  • Please don’t get upset if I don’t pick your question.
  • I did my ten odd years in the trenches writing Visual Lisp – I don’t really want to write any more, so please don’t ask for lisp code.
  • Don’t be a ass.  I don’t have time for asses.

Let’s See What Happens

So I have no idea how this will play out.  I don’t know if 4-6 hours is a reasonable amount of time to allocate each week to do this right.   I don’t know if I will be able to make the time every week.  Maybe I’ll change it from “Question of the Week” to “Question of the Every Second Week”.  I’m going to put this out there and see what happens.   I reserve the right to change anything and everything! s  E-mail your requests to contact ~@~ geospecialling dot com.

October 27, 2011

Installing Mapguide 6.5 SP1 on Windows 2008 Server

Filed under: Mapguide — Tags: , , , , — Darrin Maidlow @ 5:22 pm

In reply to a previous comment I assumed that Windows 2008 was “close enough” to Vista and that Mapguide 6.5 would install no problem.  I was wrong.  When attempting the install I was prompted with Mapguide 6.5 MDAC 2.8 Missingan “MDAC Not Detected” warning.  MDAC you may remember is the old tyme “Microsoft Data Access Component” and was one of the last releases.  MDAC has since been superseded and is apparently not included with Windows 2008.  Nor can it be installed.   I didn’t even bother contact Autodesk – I knew their response was likely going to start off with a good laugh, followed by something to the effect of “yeah that’s really old, you should probably just find an equally old Windows server.”  This of course is not an option =)   The good news though is that we can hack the Mapguide Server 6.5 installer and once installed Mapguide Server seems to run just fine.  Big thanks to Microsoft for all the effort they put into maintaining backwards compatibility.  Note this process may well work for Windows Vista and will probably work for Windows 7 – but I have not tested that.  Also – I should add this is going to be completely unsupported by Autodesk and will definitely be completely unsupported by me.  Please do the appropriate amount of testing before you put this into production.  That said, I’ve not noticed any problems with Mapguide 6.5 running on Windows 2008.

Getting Started

Mapguide 6.5 Task ManagerSo to get started.  You’ll need a piece of free software from Microsoft called .  You’ll also need your which can be downloaded from Autodesk.    Once Orca is installed start the Mapguide 6.5 server setup.  The required MSI file that we need to edit is stored inside a single self extracting exe.  You can extract these files by launching the installer on your Windows 2008 server and starting task manager once the “MDAC Not Detected” error is displayed.   Make sure the “Show processes from all users” is checked and find “ServerInstall.exe”  Right click on this process and choose “Open File Location”.  Take a copy of these files and place them somewhere, preferably on your Windows 2008 server’s local drive.

**Update– thanks to Krzysztof Skwarek for pointing out that Orca is a bit of a pain in the ass to get ahold of.  I have the Windows SDK installed already so I didn’t notice this pain point.   Given that the platform SDK is freely available, I’ve uploaded the here for your convenience. (If this is a problem Microsoft, please don’t get litigious…just send me an e-mail to let me know. I’ll gladly take it down and make the good people download the 250MB platform SDK =])

 

Hacking the Installer and Installing

Next, fire up Orca.   Choose File / Open and browse to your copy of the installation files.  Select ServerInstall.msi.  In the left hand window scroll down and find Orca MDAC Not Detected“InstallUISequence”  Select that.  In the right hand pane find and select “MDACNotDetected” .   Right click on this row and pick “Drop Row”.  You will be prompted that this will permanently remove 1 rows.  Click Ok and save the msi.

Your installation is now hacked and will get past that error message when you run ServerInstall.exe.  Make sure your run this from a local drive.  When I tried to run the install from a network share, Windows “protected” me and it wouldn’t work.

At this point you can run through the installation process.

So where were we, yes installing.  When you get to the “Select Components” screen make sure that “ISAPI MapAgent” is selected.  By default is not installed.  Don’t be alarmed on the next screen when the installer tells you it will not create the virtual directory.  Like with Vista, the installer is not capable of dealing with IIS7.  That’s no problem as configuring Mapguide 6.5 on IIS7+ is pretty simple and we’ll go over that in a minute.  You may need to reboot once the installation is complete but after that the “Autodesk Mapguide® Server 6.5” service should be up and running.   Start / Run / services.msc will bring up the services.

IIS 7 Configuration

You’ll need IIS 7 installed with support for ISAPIs.  If you do not have this installed, can probably help you out.  Next start the IIS manager (start / run / inetmgr) .  First let’s create a new application pool.  Expand the server and choose “Application Pools”.   Right click and choose “Add Application Pool”.   Name the app pool (Mapguide6.5 might be a good name).  Set the pipeline mode to classic.   If you’re on a 64 bit version of Windows you must set the app pool to 32bit mode as Mapguide 6.5 is a 32bit app.  Right click on the newly created application pool and choose “Advanced Settings”.  Set “Enable 32-Bit Applications” to true.  This setting will only be available on 64 bit systems.  If you don’t see it – you probably don’t need to worry about it.

Now expand Sites and choose the web site you want to create the application (formerly called virtual directory) in.  Right click the site and choose “Add Application”.  Name the application Mapguide6.5.  For the physical path browse to C:\Program Files\Autodesk\MapGuideServer6.5\MapAgents (or Program Files (x86) on x64 systems).  Select our newly created application pool.isapi accessisapi config

Finally we need to enable the ISAPI agent.  One last round of dirty trickery and we’ll have Mapguide 6 running.  In windows explorer browse to C:\Program Files\Autodesk\MapGuideServer6.5\MapAgents\ and make a copy of MapAgent_isapi.isa.  Name it MapAgent_isapi.dll.   In the inetmgr tree select the virtual directory and double click Handler Mappings.   Next we’re going to “Add Module Mapping”.  Set the request path to be MapAgent_Isapi.isa.  For module choose “IsapiModule”.   For executable browse to the newly copied MapAgent_Isapi.dll.  Set the name to Mapguide 6.5.  Click on the Request Restrictions button and choose the Access tab.  Click the Execute radio button.

**Update – thanks to Krzysztof Skwarek for pointing out that you can choose “Script” here instead of “Execute”.

You will be prompted to “allow this ISAPI” extension.  Click Yes.

The Test

At this point you should be done!  You can fire up a browser and test the isapi using the following url (assuming you used my default virtual directory name):

http://localhost/mapguide6.5/mapagent_isapi.isa?item=test

If you get the following results you should be good to go!

mapguiderunning

I considered posting the modified installer but I’m not sure if that would have been poking “the sleeping dragon”.  As much as I would like to help – I don’t need any nasty letters from the Autodesk legal team =).  If this is something you need done but you’re not comfortable editing installers or delving into the guts of IIS7,  feel free to contact me via .   We’d love to help you out!

July 28, 2011

Mapguide Development Tips from The Map Guy(de)

Filed under: Mapguide,Uncategorized — Tags: — Darrin Maidlow @ 3:41 pm

Jackie Ng posted a great post on that I wanted to share with you – some great tips for anyone starting out with Mapguide development or even seasoned pros!   I especially enjoyed his thoughts on antique browsers =) Thanks Jackie!  I have a couple of things to add to his list.   My first addition to his list would be Chrome.  I did have a few problems with firebug causing random ajax errors to occur in the Mapguide javascript which prompted me to switch to Chrome and its development tools.  I have not looked back…

The other thing I have to add is 6.0.  Every .NET developer should have this incredible toolset.   It really does enhance the Visual Studio IDE.  The javascript/ajax support is great with some syntax highlighting, the .NET refactoring and code generation tools are huge productivity enhancements once you get them figured out.   I couldn’t live without the navigation and  on-the-fly code analysis tools.  The built-in de-compiler can be incredibly handy too, and ties right in with the navigation tools.

If you are into Mapguide dev, I strongly encourage you to check out Jackie’s post – and become a regular reader of .

Technorati Tags: ,

September 15, 2010

Mapguide Enterprise 2011 – Fusion and Selection XML

Filed under: Mapguide,RADE — Tags: , , — Darrin Maidlow @ 3:00 pm

I’ve been working to migrate the  Mapguide 2010 code to work with 2011.  In 2010, I only implemented support for the DWF and Ajax viewer.  With the release of 2011, the new  ability to include mapping data from Google, Yahoo and Microsoft in Fusion are huge so I opted to migrate everything over.  The DWF viewer is already deprecated and I suspect the Ajax viewer will likely go next.

With 2010 and the Ajax viewer we had to get the selection from the MapFrame using the GetSelectionXML() method.  Then we had to encode, and send this value up to the web tier for processing.  I had all kinds of business logic that I was hoping to re-use with a minimal amount of modifications so I was trying to find how to recreate this functionality with Fusion.  I figured out how the selections worked on the client side using the new callback system and was getting the selection object – but I could not find anything definitively saying “There is no selection XML on the client side anymore”.    So…

There is no selection XML on the client side any more when using Fusion.

There I said it.  It makes sense too – first getting this large XML string and sending it up was a pain in the ass.  Encoding it, creating a form to submit it, etc.   I should have clued into this sooner – Fusion is updating the selection on the server side as needed. 

So in order to minimally impact the existing code – I added an additional check to some of the calls that looks a little something like this:

   1: if (String.IsNullOrEmpty(selectionXml))
   2: {
   3:     MgResourceService resSvc = (MgResourceService)siteConn.CreateService(MgServiceType.ResourceService);
   4:     sel.Open(resSvc, map.GetName());
   5:     selectionXml = sel.ToXml();
   6: }

Those four lines of code are a lot easier than all the screwing around needed in 2010 to get the selection XML.   With that small modification my existing code is working perfectly!

hope this helps someone =)

July 24, 2010

Creating .NET objects for Mapguide Enterprise 2011

Filed under: Development,Mapguide,RADE — Tags: , — Darrin Maidlow @ 11:15 pm

Better late than never…  I’ve updated my Mapguide Enterprise .NET objects to work with 2011.  The steps in my   have been modernized and simplified significantly.   This post will show you how to create (or re-create) these objects for the 2011 release of Mapguide.  Sorry for skipping 2010 =)

First, download the actual non-aplha release of and extract it.  You will need to have .NET 3.5 installed to run LINQ to XSD.  The project itself is a Visual Studio 2010, .NET 4.0 project.  You should be able to change it to .NET 3.5 with no problems.  I’m not sure about using .NET 2.0.   I still assume these steps should work with Mapguide Open Source 2.2 given its pretty much the same thing as MGE 2011.  Please let me know if you try it and that is not the case.

Building the classes

Last time around we had to mess around with Visual Studio projects, building temporary code, finding and extracting that code from temporary files.  This time around, we’re given a nice little executable that can be run in a batch file.   I’ve posted a copy of my batch file below but it was simply made using a dir /b > CreateMapguideNetObjects.cmd in the Mapguide server schema folder (which by default is to c:\Program Files\Autodesk\MapGuideEnterprise2011\Server\Schema) .  I then edited that file with a text editor that support macros and removed the following schema files:

  • FdoProviderCapabilities-1.0.0.xsd
  • LoadProcedure-1.0.0.xsd
  • LoadProcedure-1.1.0.xsd
  • LayerDefinition-1.0.0.xsd
  • LayerDefinition-1.1.0.xsd
  • LayerDefinition-1.2.0.xsd
  • SiteInformation-1.0.0.xsd
  • SiteVersion-1.0.0.xsd
  • SymbolDefinition-1.0.0.xsd
  • WebLayout-1.0.0.xsd

These files are deprecated object definitions from previous Mapguide releases.  In the end each line in the batch file looks a little like this:

LinqToXsd ApplicationDefinition-1.0.0.xsd /filename:ApplicationDefinition.cs

Executing the batch file will create a number of C# files containing appropriately named classes.

Setting up your project

At this point you should be able to fire up Visual Studio and create a new C# project.   If you have an existing project from a previous version of Mapguide its good to start fresh.  Also, don’t try this in an existing solution that is dependant on the project that contains the Mapguide objects.  This will just result in a bunch of extra screwing around to avoid compiler errors from missing code during the process.    This time around its a lot easier.  Create a new DLL project.  Add a reference to the Xml.Schema.Linq.dll file that was included with LinqToXsd.exe.   Add a reference to the following Mapguide dlls:

  • OSGeo.Mapguide.Foundation
  • OSGeo.Mapguide.Geometry
  • OSGeo.Mapguide.MapguideCommon
  • OSGeo.Mapguide.PlatformBase
  • OSGeo.Mapguide.Web

You’ll also need to ensure that the appropriate unmanaged assemblies are available in the calling applications bin folder when you go to run this stuff. 

Next place all of the generated C# files in the new project.  Once you build you’re going to see a ton of errors.  We’ll clean those up.

To resolve a lot of these errors I did a global search and replace on “global::” and replaced it with nothing.  Also, I wrapped each class in a unique wrapper classes to prevent duplicate type errors.  Finally, the case issue with DataType was still an issue – and I resolved it by changing the case on DataType to be Datatype:

   1: public string DataType {
   2: public string Datatype {

For a complete view of the changes I made do a file compare between the code in the attached zip file and your newly generated code.

<insert 3 week gap here, wherein I had so that I could actually test this newly created code, oh and I also went on vacation for a few days too =)/>

And back.  The best part about this is that it seems ALL my old code just worked with upgraded basic layouts after changing it to look for the object definitions within the new wrapper classes.   Now I just need to add support for flexible layouts and we’ll be laughing.

The Code

Please note – I didn’t rebase the code.  It’s all in the RADE.MGE namespace.  If you would like to use it, feel free to re-base it – or just leave it as is.  Also, if you create any unit tests or enhancements and would like to share them – please feel free!  

As I update the project myself, or receive updates I will update this file.

Finally, the will still work with this new project.  Perhaps one day, I’ll post some fancy new code in C# =)

Hope this comes in handy, I welcome your comments.

July 20, 2010

Mapguide 2011 Javascript error ‘OpenLayers.Lang’ is null or not an object

Filed under: Mapguide — Tags: , — Darrin Maidlow @ 10:33 pm

We’ve finally moved Mapguide Enterprise support back up the list of priorities for =)  The ability to add Google, Yahoo, and Bing data into the map with OpenLayers is very compelling.  So I’ve spent a little time (actually kind of a lot of time)  in the past little bit trying to get my Mapguide development environment setup.   To avoid cross site scripting (xss) errors when developing on my workstation I needed to install the web tier locally.   After muchos problems with license servers and the likes I came across an annoying javascript error whenever I would load a using  the local web tier:

   1: Line: 2
   2: Char: 2498
   3: Error: 'OpenLayers.Lang' is null or not an object
   4: Code: 0

Loading the web tier on the Mapguide server worked fine.  Very odd.  I ended up doing a file comparison between the two web tiers and noticed the only significant difference was this in the web.config:

   1: <staticContent>
   2:     <mimeMap fileExtension=".json" mimeType="application/json" />
   3: </staticContent>

Adding this tag to IIS 7 on Vista resulted in an error, the tag must be something new in IIS 7.5.  However, after manually adding the mime type mapping to the server – my flexible layout now loads perfectly on the local Vista web tier.SNAGHTML15f08bbe

This mime type mapping can be added on either the virtual directory, or the server level.  I chos to add it to the server.  Either way, to add it select the appropriate level in IIS manager.  In the right hand window double click “Mime Types”.  Click Add and you can enter the .json extension and the mime type.  Once this is added, Vista/IIS7 was now properly serving out flexible layers

 

August 6, 2009

Configuring Mapguide Enterprise 2009 and 2010 on the same machine

Filed under: Mapguide — Tags: — Darrin Maidlow @ 1:57 pm

So I’m a little behind on the times.  Yes I’ve finally started making the switch from Mapguide Enterprise 2009 to MGE 2010.   However, I need to keep 2009 around a little bit longer.  This resulted in wanting to configure both 2009 and 2010 on the same server.  Configuring Mapguide enterprise 2009 and 2010 on the same machine is possible, and even beneficial in a development environment.  Less VMs or servers can be a good thing in these days of crazy .  Autodesk however, recommends against doing this in a production environment.   You should probably heed this advice if this Mapguide installation is important – even from a workgroup development point of view.   Note, these steps should be relevant for the Mapguide Open Source equivalents – though I have not tried it.

After installing Mapguide 2010 (both server and web tier) on a server running 2009 and updating the license manager appropriately, you’ll notice that the service is not running.  Attempts to start the service will result in an error message logged in the Windows Application Log that looks a little bit like this:

The description for Event ID ( 0 ) in Source ( MapGuide Enterprise 2010 Server ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Port 2801 is not available, please try using a different port.

So we need to setup one of the Mapguide installations to use a different set of ports.  I’ve chosen to modify the behavior of Mapguide 2010, though these changes could be made for Mapguide 2009 instead.   For this process we’ll need three free ports.  For simplicity its nice to keep these ports sequential.  You will need to ensure that the ports you choose are available on your system.

First we need to edit the serverconfig.ini in the C:\Program Files\Autodesk\MapGuideEnterprise2010\Server\Bin folder.   First lets change the Port in the AdministrativeConnectionProperties section from 2800 to lets say 3800.   Next in the ClientConnectionProperties section change the port to 3801.  Finally change the port in SiteConnectionProperties to 3802.

Next we need to edit the webconfig.ini in the C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions folder.  We need to update the port numbers in this config to match the numbers in the server config.  Remember the web config is the client that will usually be consuming the server service.  Finally, as the configuration settings for the web tier may be cached you should restart IIS using iisreset.exe.  This will clear the cached port configurations and Mapguide Studio / Mapguide Administration will now work properly.

Once that is done, the 2009 repository can be migrated to 2010 by following the steps included in the Help/MGE2010UpgradingWindows.htm file on your installation disc/folder.

PHP Problems

Once MGE 2010 has been installed I had a problem with PHP.  Multiple PHPs can be bad news.  I’ve found that running both MGE 2009 and 2010 using the PHP provided with 2010 seems to do the trick.  First you will need to edit the Windows system path.  Update the path variable there to point to the 2010 PHP installation.  If a 2010 path variable exists already – remove the 2009 path.  Next open the IIS manager and ensure that both the MGE 2009 and MGE 2010 virtual directory trees are pointing to the MGE 2010 php extension in the Application Extension Mappings.

Once these changes have been made, do a quick IISreset and you should now be able to login to both the Mapguide admins, as well as have Mapguide Studio connect to the appropriate servers.  Again – this setup could have issues – so consider your environment and needs before configuring a server with both releases of Mapguide.

Remote Web Tiers

If you need to run a shared Mapguide server with web tiers installed on individual development machines don’t forget to set the ports on each development machine.   The Mapguide installer will prompt for the Mapguide server IP address – but the webconfig.ini will need to be updated with the appropriate ports manually.  Not doing do will result in your web tier talking to the 2009 server – and much confusion =)

Finally one note on IP addressees and remote web tiers.  If you plan to use a remote web tier – make sure your Mapguide server is setup using the actual IP address of the server and not 127.0.0.1.  If your Mapguide server is configured with 127.0.0.1, you will get a “Cannot establish connection.” error on the remote web tiers when attempting to create and use a session.  Using real IP addresses (either internal or external) will prevent this error from occurring.

Technorati Tags:

October 22, 2008

Mapguide Enterprise 2009 Update 1 (For Windows)

Filed under: Mapguide — Tags: — Darrin Maidlow @ 12:09 pm

Yay.  Autodesk today released an update for both the Mapguide Enterprise Web Tier, Server and Studio.  This release should catch Enterprise up a little more closely to the Open Source edition.  A PDF with containing some of the changes can be found   Some of these updates are pretty critical (ie. the FireFox 3 takes out your Mapguide server).  Looks like many performances updates have made it in also.

Thanks Autodesk! =)

Technorati Tags:

September 26, 2008

Developing with Mapguide Enterprise / Open Source in a shared server environment

Filed under: Mapguide — Tags: — Darrin Maidlow @ 7:41 pm

I have enough junk running on my development machine.  In an effort to try and keep my workstation speedy – I don’t install any unnecessary services (Oracle server, Mapguide Server etc) on this machine.  In a larger development environment, running multiple servers on local development machines has a few other less than desirable results.  For example licensing issues and costs could increase, data management can become more complex, and just managing the extra services on N machines could cause a lot more work for your already overworked IT guy.

So instead I have centralized my server resources into a nice VM setup running on my beefy Dell server.  Now, regardless of which machine I use to develop I can still access the same data sets.  This is especially nice when traveling.  Specifically Mapguide Server and web tier are installed on my development web server.  When coding, I will either use my local IIS or the built in Visual Studio web server.  This poses one problem when working with Mapguide.  Referencing the web tier on the shared server from another web server will result in (XSS) errors.  Basically, javascript on one web server cannot access javascript code on another web server, which under most circumstances is a good thing.  When trying to develop using the Mapguide Web API on a central Mapguide server this poses a problem as the web tier API is wholly contained within the virtual directory on another server.  Gotta love when ‘security’ jumps up bites us in the behind.

The simple solution to this problem is to install the Mapguide web tier on every development machine.  This will require that each development machine have a web server installed, but chances are that is already the case.  When installing the web tier be sure to have the IP address of the Mapguide server handy as it will needed during the install.  Once the web tier is running locally, reference the local web tier in your URLs and the cross site scripting vulnerabilities go away!  If you’re running the 64 Bit version of Vista on your development machine, check out my post installing the

Technorati Tags:

Older Posts »

Powered by WordPress

Switch to our mobile site