Hi There,
I seem to have a problem using MS MapPoint Webservice in my DNN module. I was wondering if any of you chaps might be able to help....
The module i am writing is based around code supplied in the MS MapPoint SDK and works perfectly in a standalone project.
I then downloaded the VS2005 DNN 4.5.3 Starter Kit and installed that - all worked perfectly.
I then used the Starter Kit to add a DNN module template to my project - again, all worked perfectly.
I then added the MapPoint Web Reference to the project at DNN level just to try and get it working
I then migrated all the code from the standalone project into the DNN module and it compiles with no errors.
But, when i run the project and try and create a map it pukes with the error :
System.MissingMemberException was unhandled by user code
Message="Public member 'FindServiceClass' on type 'global_asax' not found."
Source="Microsoft.VisualBasic"
StackTrace:
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at ParcelRoute.ViewParcelRoute.buttonGetRoute_Click(Object sender, EventArgs e) in C:\DotNetNuke97\DesktopModules\ParcelRoute\ViewParcelRoute.ascx.vb:line 127
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
when running the following code:
Try
myFindResultsPointA = ParcelRoute.FindServiceClass.FindAddress(findAddressSpecA)
Catch myException As SoapException
'Your exception handling goes here
End Try
I have been talking in depth with Mike Lancaster, who writes the DNN Module Development guide and he thinks it's something to do with DNN. He commented:
"I think it is failing because DotNetNuke is running under partial trust and it need full trust. But I'm way out of my comfort zone at this point. Hopefully someone has an answer."
Previous Thread is at: http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/111/threadid/145061/threadpage/1/scope/posts/Default.aspx
From what I can see the functions are in a global.asax.vb in my \app_code\ParcelRoute directory. Which is where Mike said it should be...
Have you got any thoughts on what might be going wrong please?
(Also, I tried doing what was mentioned in the posting above but it says that the asmx file is not found... weird.... never mind. I think it should work as it is using the Web Reference at DNN level although I will have to fix this problem before i can make it into a PA)
Below is a copy of the code in my global.asax.vb
'---------------------------------------------------------------------
' This file is part of the Microsoft MapPoint SDK Code Samples.
'
' Copyright (C) Microsoft Corporation. All rights reserved.
'
'This source code is intended only as a supplement to Microsoft
'Development Tools and/or on-line documentation. See these other
'materials for detailed information regarding Microsoft code samples.
'
'THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'PARTICULAR PURPOSE.
'---------------------------------------------------------------------
Imports System.Web
Imports System.Web.SessionState
Imports System.Net ' for network logon
Imports System.Diagnostics ' for debug asserts
Namespace ParcelRoute
' SUMMARY
' An instance of this class is created by ASP .NET for every worker thread.
' Each web request is associated with an instance of this class, so it makes
' a handly place to put objects that are needed for each request, but are
' expensive to initialize.
' From the code behind of an individual page, the instance of this class
' associate with the request can be obtained from Context.ApplicationInstance
Public Class [Global]
Inherits System.Web.HttpApplication
#Region " Component Designer Generated Code "
' SUMMARY
' Constructor, use to populate per-instance data.
' In our application, each instance will create objects for accessing
' the MapPoint .NET service.
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Initializes the MapPoint .NET connection objects
InitializeMPNetConnection()
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
' This section handles the initialization and management of the classes for the
' MapPoint .NET Service
' SUMMARY
' These are the actual instances of the objects that call the MapPoint .NET
' service
Private renderService As MapPointService.RenderServiceSoap
Private findService As MapPointService.FindServiceSoap
Private routeService As MapPointService.RouteServiceSoap
Private commonService As MapPointService.CommonServiceSoap
' Performs the work needed to initialize the connection to the
' MapPoint .NET service
Private Sub InitializeMPNetConnection()
Try
' First, create the render service
renderService = New MapPointService.RenderServiceSoap()
' Create and set the logon information (note comment in
' web.config -- here would be the place to
' decrypt/unhash the user/password from the config file).
Dim ourCredentials As New NetworkCredential(System.Configuration.ConfigurationManager.AppSettings("MPUser"), System.Configuration.ConfigurationManager.AppSettings("MPPass"))
renderService.Credentials = ourCredentials
renderService.PreAuthenticate = True
' Next, create the find service
findService = New MapPointService.FindServiceSoap()
' Set the logon information
findService.Credentials = ourCredentials
findService.PreAuthenticate = True
' Next, create the route service
routeService = New MapPointService.RouteServiceSoap()
' Set the logon information
routeService.Credentials = ourCredentials
routeService.PreAuthenticate = True
' Last, create the common service
commonService = New MapPointService.CommonServiceSoap()
' Set the logon information
commonService.Credentials = ourCredentials
commonService.PreAuthenticate = True
Catch ex As Exception
'Your exception handling goes here
End Try
End Sub
' An instance of the find service class
Public ReadOnly Property FindServiceClass() As MapPointService.FindServiceSoap
Get
FindServiceClass = findService
End Get
End Property
'An instance of the render service class
Public ReadOnly Property RenderServiceClass() As MapPointService.RenderServiceSoap
Get
RenderServiceClass = renderService
End Get
End Property
'An instance of the route service class
Public ReadOnly Property RouteServiceClass() As MapPointService.RouteServiceSoap
Get
RouteServiceClass = routeService
End Get
End Property
'An instance of the common service class
Public ReadOnly Property CommonServiceClass() As MapPointService.CommonServiceSoap
Get
CommonServiceClass = commonService
End Get
End Property
End Class
End Namespace