[mapguide-users] The type initializer for 'OSGeo.MapGuide.MapGuideApiPINVOKE' threw an exception

Smith Roman autisi at yahoo.com
Sat Jan 18 00:34:42 PST 2014




Hi All,

I am using visual studio 2012 on a windows 7 enterprise pc. I created an asp.net web site and successfully installed the nuget package. (https://nuget.org/packages/mapguide-api-web-x64).

I then created a Default.aspx page with the following code:



<%@ Page language="c#" Debug="true"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="OSGeo.MapGuide" %>

<%-- ? ?<!-- #Include File="utilityfunctions.aspx --> ? --%>

<script runat="server">
String webLayout = "Library://Samples/Sheboygan/Layouts/SheboyganAsp.WebLayout";
String defaultUser = "Anonymous";
String defaultPassword = "";
String sessionId = "";
String configFilePath = "C:/Program Files/OSGeo/MapGuide/Web/www/webconfig.ini";
//String configFilePath = "C:/Program Files/OSGeo/MapGuide/Web/www";

//String configFilePath = "@C:\Program Files\OSGeo\MapGuide\Web\www\webconfig.ini";

??
</script>

<%
? ? try
? ? {
? ? ? ? // Initialize a session and register a variable to hold the
? ? ? ? // session id, then initialize the Web Extensions, connect
? ? ? ? // to the site, and create a session.

? ? ? ? MapGuideApi.MgInitializeWebTier(configFilePath);

? ? ? ? MgUserInformation userInfo = new MgUserInformation(defaultUser, defaultPassword);
? ? ? ? MgSite site = new MgSite();
? ? ? ? site.Open(userInfo);
? ? ? ? sessionId = site.CreateSession();
? ? }
? ? catch (Exception e)
? ? {
? ?
? ? ? ? Response.Write(" map guide error: " + e.Message);
? ? ? ??
? ? ? ??
? ? }
%>

<html>
<head>
<title>Viewer Sample Application</title>
</head>
<frameset rows="30,*" frameborder="no" framespacing="0">
<frame id="titleFrame" frameborder="no" marginwidth="0" marginheight="0" scrolling="no" src="title.html">
<frame id="viewerFrame" frameborder="no" marginwidth="0" marginheight="0" scrolling="no" src="../mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>">
</frameset>
</html>



The error I am now getting is " The type initializer for 'OSGeo.MapGuide.MapGuideApiPINVOKE' threw an exception ". I am using the 64bit version of map guide 2.5.2.

?
Any ideas ?


Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20140118/0b85a6cc/attachment.html>


More information about the mapguide-users mailing list