2
我已經在DotNetNuke7中實現了一個使用Angular Js和TypeScript的模塊,我在一個名爲customerNew的web項目中實現了我的所有輸入窗體和js,並將Web API添加到另一個項目命名爲CustomerNewController,它有我的方法,但是當我從我的Web項目URL到Api.It不處理。我已經實現了一個路由映射器,但仍然無法取得成功。DotNetNuke7:-Web Api不會觸發調用
我的路由映象類如下考慮: -
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetNuke.Web.Api;
using System.Web.UI.WebControls;
namespace CustomerNewController
{
class RouteMapper : IServiceRouteMapper
{
public void RegisterRoutes(IMapRoute mapRouteManager)
{
mapRouteManager.MapHttpRoute("CustomerNewController", "default", "{controller}/{action}",
new[] { "CustomerNewController" });
}
}
}
這裏是我的WebAPI
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using System.Web.UI;
using System.Xml.Serialization;
using DotNetNuke.Entities.Users;
using System.Web.Services;
using DotNetNuke.Web.Api;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules.Communications;
using DotNetNuke.Entities.Modules;
namespace CustomerNewController
{
public class CreateController : DnnApiController
{
[AllowAnonymous]
[HttpGet]
public HttpResponseMessage HelloWorld()
{
return Request.CreateResponse(HttpStatusCode.OK, "Hello World!");
}
}}
我的URL
http://localhost/dnn7/DesktopModules/CustomerNewController/Api/Create/HelloWorld
這裏是我的文件夾結構
請分享確切的錯誤代碼,您收到 - 404或500? – Ashish
@它是404 –