ℙℕℤℝ 2013-09-19 14:18
浏览 70

DNN Web API服务器错误

I'm repeatedly getting an Internal Server Error 500 when trying to make a simple call to a DNN Web API controller. I do not get this error on my development machine, nor do I get it on one of our deployment servers. However, one of our other deployment servers is the problem; and I'd like to figure out why.

Consider the following, simplistic API controller in TheBestController.cs

namespace MyTestLibrary.Controllers
{   
    public class TheBestController : DnnApiController
    {
        [DnnAuthorize]
        [HttpPost]
        public HttpResponseMessage TestMe()
        {
            return Request.CreateResponse(HttpStatusCode.OK, "I'm working");
        }

     }
}

With this RouteMapper in RouteMapper.cs

using DotNetNuke.Web.Api;

namespace MyTestLibrary
{
    public class RouteMapper : IServiceRouteMapper
    {
        public void RegisterRoutes(IMapRoute mapRouteManager)
        {
            mapRouteManager.MapHttpRoute("TheBestController", "default", "{controller}/{action}",  new[] { "MyTestLibrary.Controllers" });
        }
    }
}

With the following AJAX call from my Javascript:

$.post("DesktopModules/MyTestLibrary/API/TheBest/TestMe", function(data) {
        alert(data);
 });

I have made sure that all of the correct permissions are set for the DNN application in IIS (as well as mirrored those and all other pertinent settings that are on our server that has this working). I place the compiled MyTestLibrary.dll in the bin folder of the DNN site, and I place the javascript file in the Resources/Shared/scripts folder of the DNN site. The DNN site is reading the javascript with no issues, and I am not using a module (and would not like to because I want all of my code to be easily transferrable to an MVC site).

I have also tried using the [AllowAnonymous] tag on the controller method (to no avail).

The version of DNN on all machines is 07.01.01, and the two servers are running Server 2008 R2 64bit. The dev machine is running Win 7 64 bit.

Any ideas?

  • 写回答

1条回答

  • weixin_33676492 2013-09-20 02:13
    关注

    To break the comments out into an answer ;)

    I've seen where IIS on Windows Server 2008 can somehow corrupt a folder that a DNN website is using, and that starts to cause issues with certain web services in DNN. Two solutions that I know have worked in the past for me.

    1) Setup a new site in IIS and install DNN in that folder. or 2) Move the DNN files to a different folder on the server, point the existing IIS website to that folder, instead of the original one.

    One of those two should hopefully work for most people that run into this problem.

    Now, what exactly goes wrong in IIS and why can the existing folder be fix? No clue :(

    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)