ASP.NET and mapscript - unable to load DLL

Mike Boos mboos at AUGSIGNALS.COM
Mon Aug 22 10:07:35 EDT 2005


I am certain the error occurs on that line - I even commented out all 
the other lines and ran it again to be sure. It is also the very first 
line in which I use the MapScript interface in the file.

I have also tried invoking the MapScript code from a command line app 
and it runs successfully.

Mike

Tamas Szekeres wrote:

>Are you sure this error happens at the row you have mentioned? It seems
>that you are using an object instance without calling "new" previously.
>However Mapserver errors will result in an exception passed back through
>the SWIG interface.
>
>You should try to insantiate mapObj in a Windows test application. The
>improper security context of aspnet_wp may also be a problem.
>
>Tamas
>
>
>On Fri, 19 Aug 2005 16:58:00 -0400, Mike Boos <mboos at AUGSIGNALS.COM> wrote:
>
>  
>
>>Thank you for that advice! I ran filemon and discovered that it was
>>trying (unsuccessfully) to find libcurl.dll - which somehow didn't show
>>up in my dependency tracking tool. It's now in my system path.
>>
>>I'm now running into new trouble. When I try to create a mapObj with
>>"mapObj m_obj = new mapObj(mapfile);" I get the following error:
>>
>>
>>   /Object reference not set to an instance of an object./
>>
>>* Description: *An unhandled exception occurred during the execution of
>>the current web request. Please review the stack trace for more
>>information about the error and where it originated in the code.
>>
>>* Exception Details: *System.NullReferenceException: Object reference
>>not set to an instance of an object.
>>
>>Any suggestions?
>>Mike
>>
>>Tamas Szekeres wrote:
>>
>>    
>>
>>>Have you tried SysInternals's filemon or a similar program to monitor the
>>>expected location of theese files?
>>>
>>>
>>>
>>>On Fri, 19 Aug 2005 13:23:38 -0400, Mike Boos <mboos at AUGSIGNALS.COM>
>>>      
>>>
>wrote:
>  
>
>>>
>>>      
>>>
>>>>mapscript_csharp.dll is present in the bin directory. All the others are
>>>>in system32. gdal12.dll is in both as I'm somehow invoking a function
>>>>
>>>>
>>>>        
>>>>
>>>>from it from elsewhere and not having the slightest bit of trouble with
>>>
>>>
>>>      
>>>
>>>>that part (I'm using a direct DllImport attribute). So maybe I will have
>>>>to try one of the alternatives. Oh well.
>>>>
>>>>Mike
>>>>
>>>>Abe Gillespie wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Did you move mapscript.dll to system32 as well?  The only DLL that
>>>>>should be in your bin dir is mapscript_csharp.dll.
>>>>>
>>>>>Suggestions:
>>>>>1.  Write the mapfile by hand with the file streaming objects?
>>>>>2.  Wrap the MapServer CGI executable with ASP.NET (I think someone
>>>>>did just this some time ago).
>>>>>3.  If this is all you're doing, you *might* be able to get away with
>>>>>it in ASP.NET.  See if there's a way to protect a section of ASP.NET
>>>>>code with a semaphore or similar construct.  Is there something that
>>>>>protects in the virtual thread environment?
>>>>>
>>>>>-Abe
>>>>>
>>>>>On 8/19/05, Mike Boos <mboos at augsignals.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>I tried moving the dlls to the system32 directory, but that doesn't
>>>>>>            
>>>>>>
>have
>  
>
>>>>>>any effect (am I missing any other dependencies?)
>>>>>>
>>>>>>Unfortunately, I'm kind of stuck with ASP.NET, as that's what the rest
>>>>>>of the site relies upon. I'm trying to improve the present setup which
>>>>>>involves sending a request to a C++ CGI program which writes a map
>>>>>>            
>>>>>>
>file
>  
>
>>>>>>to the hard disk and forwards the request to mapserv.exe. If you'd ask
>>>>>>me, that's a bit of a kluge, and without Mapscript, all I could do to
>>>>>>improve on that would be to take out the C++ program and have the map
>>>>>>file generated from within the ASP.NET program itself. Can you think
>>>>>>            
>>>>>>
>of
>  
>
>>>>>>a better way to accomplish the same task?
>>>>>>
>>>>>>Mike
>>>>>>Abe Gillespie wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Placing the depended-on DLLs into the bin dir will do nothing.  I
>>>>>>>assume you're on a windows box.  Therefore the easiest way to take
>>>>>>>care of this is by placing all the DLLs (except for map_script) into
>>>>>>><windows>\system32 where <windows> is the system windows directory
>>>>>>>(c:\winnt, c:\windows, etc.).
>>>>>>>
>>>>>>>With that said, you're entering a world of pain by using C#
>>>>>>>              
>>>>>>>
>map_script
>  
>
>>>>>>>in ASP.NET.  Much of the map_script DLL is thread unsafe, that
>>>>>>>combined with ASP.NET's supremely weird threading model (e.g. virtual
>>>>>>>threads), you're going to encounter a plethora of problems.  This is
>>>>>>>why you almost never see MapServer + ASP.NET discussion threads.
>>>>>>>
>>>>>>>To get more info, search the archives.  You should find ten or so
>>>>>>>messages about this topic.
>>>>>>>
>>>>>>>-Abe
>>>>>>>
>>>>>>>On 8/18/05, Mike Boos <mboos at augsignals.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>Hello
>>>>>>>>
>>>>>>>>I'm trying to run Mapscript using the SWIG C# bindings on an ASP.NET
>>>>>>>>server. I compiled the 4.6.0 version of MapServer and have placed
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>what I
>>>
>>>
>>>      
>>>
>>>>>>>>believe to be the appropriate dependencies (mapscript_csharp.dll,
>>>>>>>>mapscript.dll, libmap.dll, bgd.dll, gdal12.dll, pdflib.dll) in the
>>>>>>>>                
>>>>>>>>
>bin
>  
>
>>>>>>>>directory on my server. It is appears to be finding
>>>>>>>>mapscript_csharp.dll, but is having trouble finding mapscript.dll or
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>one
>>>
>>>
>>>      
>>>
>>>>>>>>of its dependencies. I am seeing the following error message:
>>>>>>>>
>>>>>>>>
>>>>>>>>Server Error in '/' Application.
>>>>>>>>
>>>>>>>>
>>>>>>>> /Unable to load DLL (mapscript)./
>>>>>>>>
>>>>>>>>* Description: *An unhandled exception occurred during the execution
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>of
>>>
>>>
>>>      
>>>
>>>>>>>>the current web request. Please review the stack trace for more
>>>>>>>>information about the error and where it originated in the code.
>>>>>>>>
>>>>>>>>* Exception Details: *System.DllNotFoundException: Unable to load
>>>>>>>>                
>>>>>>>>
>DLL
>  
>
>>>>>>>>(mapscript).
>>>>>>>>
>>>>>>>>Am I missing a dependency? Or do I need to set some configuration
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>option
>>>
>>>
>>>      
>>>
>>>>>>>>or place the files elsewhere?
>>>>>>>>
>>>>>>>>Thanks!
>>>>>>>>Mike Boos
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>            
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>
>>>
>>>      
>>>
>
>
>
>  
>



More information about the mapserver-users mailing list