DNN Web API服务器错误


                    

在尝试对DNN Web API控制器进行简单调用时,我反复收到内部服务器错误500。 我没有在开发机器上收到此错误,也没有在我们的一台部署服务器上收到此错误。 但是,我们的 other </ em>部署服务器之一就是问题所在。 我想找出原因。 </ p>

TheBestController.cs </ strong> </ p>中考虑以下简单的API控制器

 命名空间MyTestLibrary.Controllers
{
     公共类TheBestController:DnnApiController
     {
         [DnnAuthorize]
         [HttpPost]
         公共HttpResponseMessage TestMe()
         {
             返回Request.CreateResponse(HttpStatusCode.OK,“我在工作”);
         }

      }
}
</ code> </ pre>

RouteMapper.cs </ strong> </ p>中使用此RouteMapper

 使用DotNetNuke.Web.Api;

命名空间MyTestLibrary
{
     公共类RouteMapper:IServiceRouteMapper
     {
         公共无效RegisterRoutes(IMapRoute mapRouteManager)
         {
             mapRouteManager.MapHttpRoute(“ TheBestController”,“ default”,“ {controller} / {action}”,new [] {“ MyTestLibrary.Controllers”});
         }
     }
}
</ code> </ pre>

使用我的Javascript进行以下AJAX调用:</ p>

  $。post(“ DesktopModules / MyTestLibrary / API / TheBest / TestMe”,函数(数据){
         警报(数据);
  });
</ code> </ pre>

我已经确保为IIS中的DNN应用程序设置了所有正确的权限(以及在我们的服务器上具有此功能的所有这些以及所有相关设置的镜像)。 我将已编译的 MyTestLibrary.dll </ strong>放置在DNN站点的bin文件夹中,并将javascript文件放置在DNN站点的Resources / Shared / scripts文件夹中。 DNN站点正在阅读javascript,没有问题,并且我没有使用模块(并且不想这样做,因为我希望所有代码都可以轻松地转移到MVC站点)。</ p>

我还尝试在控制器方法上使用 [AllowAnonymous] </ code>标记(无济于事)。</ p>

所有计算机上的DNN版本为07.01.01,并且两台服务器都运行Server 2008 R2 64bit。 开发人员机器正在运行Win 7 64位。</ p>

有什么想法吗?</ p>
     </ div>

展开原文

原文

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个回答


将评论分解成一个答案;)</ p>

我已经看到Windows Server 2008上的IIS可以在何处破坏DNN网站正在使用的文件夹,并且开始引起DNN中某些Web服务的问题。 我知道过去有两种解决方案对我有用。</ p>

1)在IIS中设置一个新站点,然后在该文件夹中安装DNN。
要么
2)将DNN文件移动到服务器上的其他文件夹,将现有IIS网站指向该文件夹,而不是原始文件夹。</ p>

这两个中的一个有望对大多数遇到此问题的人起作用。</ p>

现在,IIS中到底出了什么问题?为什么可以修复现有文件夹? 没有头绪:( </ p>
     </ div>

展开原文

原文

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 :(

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐