的WebAPI部署到Azure中 - 控制器不工作(500错误) [英] WebApi Deployed to Azure - Controllers Don't Work (500 Error)

查看:145
本文介绍了的WebAPI部署到Azure中 - 控制器不工作(500错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包装Dynamics CRM Online中的Web服务,并提供了一​​个REST API一个项目的WebAPI。我有一个简单的控制器,从CRM得到了一些接触,他们返回给调用者。

I have a WebApi project that wraps the Dynamics CRM Online web service and provides a REST api. I have a simple controller that gets some contacts from CRM and returns them to the caller.

当我在当地模拟器运行一切正常。然而,当我将项目部署到Azure的,我能达到主页,但控制器都返回HTTP 500错误。为什么会出现这种情况?我怎么能解决,以获得更多的细节?

Everything works fine when I run it in the local emulator. However, when I deploy the project to Azure, I can reach the home page, but the controllers all return http 500 errors. Why would this happen? And how can I troubleshoot to get more details?

更新

问题是如何运行在Azure的Web角色的服务器实例2012没有Microsoft.IdentityModel.dll的。我通过RDP打开Web角色实例,安装小提琴手,并使得从提琴手到本地IIS服务器的请求发现了这个。它回应详细的错误。

The issue is with the absence of Microsoft.IdentityModel.dll on the Server 2012 instance running the web role in Azure. I found this by opening web role instance in RDP, installing Fiddler, and making the request from Fiddler to the local IIS server. It responded with the detailed error.

现在我的问题是搞清楚如何在Windows Azure的Web角色使IdentityModel。你应该能够通过服务器2012将其添加添加角色和功能向导,但它完全锁定在Web角色。你不能检查尚未选取的复选框。这甚至可能?

Now my issue is figuring out how to enable IdentityModel on a Windows Azure Web Role. You're supposed to be able to add it via the Server 2012 Add Roles and Features wizard, but it's totally locked down on the Web Role. You can't check any boxes that aren't already checked. Is this even possible?

推荐答案

这个问题是给到Windows标识基础的Web角色访问时,它本质上不存在。马克Schweigert提供清晰的步骤,在这里做这样的:

The issue is giving the Web Role access to Windows Identity Foundation when it's inherently not there. Marc Schweigert provides clear steps to do this here:

<一个href=\"http://blogs.msdn.com/b/devkeydet/archive/2013/01/27/crm-online-amp-windows-azure-configuring-single-sign-on-sso.aspx\" rel=\"nofollow\">http://blogs.msdn.com/b/devkeydet/archive/2013/01/27/crm-online-amp-windows-azure-configuring-single-sign-on-sso.aspx

转至23:00标志的视频,你会看到4个必要步骤:

Go to the 23:00 mark of the video and you'll see the 4 necessary steps:


  1. 参考Microsoft.IdentityModel.dll(需要安装WIF SDK)
    一个。设置复制本地=真

  2. 在您的Web角色项目创建RegisterWIFGAC.cmd

  3. 在ServiceDefinition.csdef中调用RegisterWIFGAC.cmd创建启动任务

  4. 添加GACUTIL到项目(在启动任务中)把Microsoft.IdentityModel.dll在每一个Web角色开始时间GAC)。

这篇关于的WebAPI部署到Azure中 - 控制器不工作(500错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆