Hello!
I tried the example as a class project in VBnet too and it works after making the changes mentioned above, it works as expected .. thanks a lot for the tip with the Namespace!
Now I wanted to add a service to my own module that is based on the christoc VB2012 template for VB.
I added a class "WSController to the Project Directory, at the same level as view.ascx etc and added the code above
First when trying to call the Service from the browser i got a message about a missing dll
(Could not load file or assembly 'FiftyOne.Foundation' or one of its dependencies." ... I decided to solve it quick and very dirty and added a reference to that dll in dnns bin folder ...
Now when I try to access the Service by calling:
http://localhost/dnn7/DesktopModules/myModule/API/WS/HelloWorld
it produces 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.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] DotNetNuke.Common.Globals.get_Status() +158 DotNetNuke.HttpModules.RewriterUtils.OmitFromRewriteProcessing(String localPath) +55 DotNetNuke.HttpModules.RequestFilter.RequestFilterModule.FilterRequest(Object sender, EventArgs e) +205 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +79 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +164
|
please can anybody assist to sort out what the problem may be?
In the Project Properties I have already tried to remove the base Namespace (mmm.Modules.mmmModule1) and adding it to the file "WSController" wrapping the Class "WSController" with no success.
The module is set up in localhost/dnn7/DesktopModules/mmmModule1
In this Folder there lies the Class "WSController.vb" with the following code:
Imports System
Imports System.Net
Imports System.Net.Http
Imports System.Web.Http
Imports DotNetNuke.Web.Api
Public Class WSController
Inherits DnnApiController
Implements IServiceRouteMapper
<DnnAuthorize()> _
<HttpGet()> _
Public Function HelloWorld() As HttpResponseMessage
Return Request.CreateResponse(HttpStatusCode.OK, "Hello World!")
End Function
' Route Mapper
Public Sub RegisterRoutes(mapRouteManager As IMapRoute) Implements IServiceRouteMapper.RegisterRoutes
mapRouteManager.MapHttpRoute("mmmModule1", "default", "{controller}/{action}", New String() {"mmmModule1"})
End Sub
End Class
Thanks in advance for any hint that puts me back on the road ;-)
kind regards
Don