ℙℕℤℝ 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 :(

    评论

报告相同问题?

悬赏问题

  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?