【发布时间】:2016-03-22 20:25:59
【问题描述】:
我已经实现了 Azure 移动应用和 Xamarin.Forms 客户端应用程序。我希望用户从电话使用 facebook 登录,并且还想获取用户的个人资料数据。为此,我在 Azure 移动应用程序的 API 控制器中实现了额外的调用/方法。我已按照您的文章执行步骤并放置代码,但是当我在本地主机上运行移动应用程序或尝试发布时以某种方式收到以下错误消息
找到了与名为“Home”的控制器匹配的多种类型。如果服务此请求 ('') 的路由发现多个控制器定义为相同名称但不同的命名空间,则可能会发生这种情况,这是不受支持的。 'Home' 的请求找到了以下匹配的控制器:
Microsoft.Azure.Mobile.Server.Controllers.HomeController Microsoft.WindowsAzure.Mobile.Service.Controllers.HomeController
我知道这是相关的配置设置。我有以下代码
HttpConfiguration config = new HttpConfiguration();
new MobileAppConfiguration()
.UseDefaultConfiguration()
.ApplyTo(config);
app.UseWebApi(config);
app.UseAppServiceAuthentication(new AppServiceAuthenticationOptions
{
SigningKey = ConfigurationManager.AppSettings["SigningKey"],
ValidAudiences = new[] { ConfigurationManager.AppSettings["ValidAudience"] },
ValidIssuers = new[] { ConfigurationManager.AppSettings["ValidIssuer"] },
TokenHandler = config.GetAppServiceTokenHandler()
});
如果我从上面删除默认配置,那么异常消息就会消失,但在这种情况下,我看不到应用程序被正确托管,即它在浏览器中显示空白页面,而不是在应用程序正确托管后显示的就绪页面。
【问题讨论】:
标签: azure xamarin.forms azure-mobile-services azure-api-apps