Tag: azure mobile services

Azure移动服务错误:在程序集中找到多个具有名称的静态类作为引导程序

从Visual Studio 2013部署新版本的C#MobileService项目后,Azure日志中报告了以下错误: 在程序集中找到了多个名为“WebApiConfig”的静态类作为引导程序:{{My.MobileService.Project,myMobileService}}。 请仅提供一个类或使用“IBootstrapper”属性来定义唯一的引导程序。 实际上,如果提到的类文件有多个版本,如何在部署新版本之前清除它?

Azure移动应用程序 – 尝试POST时获取405(方法不允许)

我正在尝试将Azure Mobile Service .NET后端迁移到Azure移动应用程序。 我使用的是一些自定义Web Api控制器,迁移后我得到405 (Method Not Allowed) / The requested resource does not support http method ‘POST’. 尝试POST到以前工作的控制器方法时出错。 我花了几个小时尝试不同的CORS设置但到目前为止我没有成功。 这就是我目前配置Web Api的方式: HttpConfiguration config = new HttpConfiguration(); new MobileAppConfiguration() .UseDefaultConfiguration() .ApplyTo(config); var cors = new EnableCorsAttribute(“*”, “*”,”*”); //var cors = new EnableCorsAttribute(“*”, “*”,”GET,POST,DELETE,HEAD,PUT,PATCH,OPTIONS”); config.EnableCors(cors); config.Routes.MapHttpRoute( name: “Rest”, routeTemplate: “rest/{controller}/{id}”, defaults: new { id = […]

Azure Mobile App使用现有数据库

我是第一次尝试使用Azure移动应用程序,我应该将其连接到现有的已填充的SQL Azure数据库。 据我所知,必须在表中添加Version , CreatedAt , UpdatedAt和Deleted列,最重要的是必须将id列设置为identity。 问题是在某些表上我已经有了一个标识列(例如ItemID ),如果不破坏连接到数据的现有第三方应用程序,我就无法重命名。 问题是:有没有办法避免使用身份标识字段,也许是某种方式映射原始身份? [编辑]我已经看过网上的样本了,就像那样: https://blogs.msdn.microsoft.com/azuremobile/2014/05/22/tables-with-integer-keys-and-the-net-backend/ 但是移动服务和移动应用程序之间似乎存在一些差异,如果有人指出我正确的方向,我真的很高兴,也许有一个可用的例子

azure移动服务活动目录身份validationX-ZUMO-AUTH令牌在注销后在邮递员中有效

我有Azure Mobile Service和AD设置进行身份validation。 通过移动应用程序注销并登录完美。 AD应用程序回复url为https://test.azure-mobile.net/signin-aad client = new MobileServiceClient (applicationURL, applicationKey); var authResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory); var data = await client.InvokeApiAsync(“testAPI”, HttpMethod.Get, null); //Works client.Logout(); // LOGOUT var data = await client.InvokeApiAsync(“testAPI”, HttpMethod.Get, null); //Unauthorized Error at mobile side. Request not going to API 这项工作是完美的。 但是如果我在LOGOUT之后从authResult复制令牌,我可以使用相同的令牌从邮递员调用API。 标题:X-ZUMO-AUTH→令牌 我如何validation令牌? Azure移动服务端需要进行任何设置来validation和阻止此操作吗?

Web API转换为Azure Mobile Service而不是序列化所有属性

我有一个工作的Web API,我正在转换为.Net Azure移动服务。 API返回一个复杂的模型 – 具有属性的对象 – 其中一些是其他对象的集合。 这与普通的Web API一样正常,但是使用Azure移动服务我遇到了一个问题,即我的某个模型没有序列化它的所有属性。 当我在控制器中的return语句上设置断点时,我看到所有属性及其值都存在。 这让我相信问题在于序列化(JSON)。 return Request.CreateResponse(HttpStatusCode.OK, myModel); 正在序列化的属性示例: public Guid Id { get; set; } public IEntityDto ModelDto { get; set; } //this is an object with many properties all of which serialize 未序列化的属性示例: public ItemStatus Status { get; set; } //this is an enum public string […]

在Windows phone Silverlight 8.1上接收WNS推送通知

我有windows phone 8.1 silverlight应用程序,我希望使用新框架WNS接收Notfications。 我在package.appxmanifest: 并将其添加到移动服务中心。 为此,我删除了对MPNS使用的旧引用,并为WNS添加了以下内容: 使用Windows.UI.Notifications; 使用Windows.Networking.PushNotifications; 使用Windows.UI.StartScreen; 这导致了获得channelURI的新方法: public static PushNotificationChannel CurrentChannel { get; private set; } public async static Task UploadChannel() { bool newChannel = false; var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var settings = Windows.Storage.ApplicationData.Current.LocalSettings.Values; object oldChannel; settings.TryGetValue(“channelURI”, out oldChannel); if ((oldChannel as PushNotificationChannel).Uri != CurrentChannel.Uri) { settings.Add(“channelURI”, CurrentChannel); newChannel = […]

有没有办法从预先编写的C#Azure Functions自动生成Swagger标签?

是否有人知道任何.NET属性可用于注释预编译的C#Azure函数,以便它可以自动生成Swagger标记? 例如,我想在Swagger中自动生成“tags”条目: /api/v1/revision: get: operationId: /api/v1/revision/get tags: – System produces: [] consumes: [] parameters: [] description: Gets the API version responses: ‘200’: description: Success operation security: – apikeyQuery: [] 这是我的C#函数: public static class VersioningService { [FunctionName(“ApiVersion”)] public static async Task ApiVersion([HttpTrigger(AuthorizationLevel.Function, “get”, Route = “v1/revision”)]HttpRequestMessage req, TraceWriter log) { return req.CreateResponse(HttpStatusCode.OK, “API Version: 1.0340”); } […]

具有视图或存储过程的Azure移动应用程序中的脱机数据同步

我们已经创建了一个Xamarin Forms应用程序,目前只在Android上运行。 后端是.Net Azure移动应用程序服务 我从文章中了解到,离线数据同步仅适用于“/ tables”端点。 (至少那是我所理解的) 但是我的API公开了来自连接查询(实体关系)的数据,还有一些来自存储过程。 这是否意味着这些不适用于当前的SDK? 我有什么选择? 我是否公开表并处理客户端中的连接的业务逻辑?

无法在表上创建多个聚簇索引

键入update-database后出现以下错误: 无法在表’dbo.AppUsers’上创建多个聚簇索引。 删除现有的聚簇索引“PK_dbo.AppUsers”,然后再创建另一个。 我正在开发Azure移动服务。 我有三种数据模型: public class AppUser : EntityData { public string Username { get; set; } public virtual ICollection userRatings { get; set; } } public class PlaceItem : EntityData { public string PlaceName { get; set; } public int Group { get; set; } public string XCoordinate { get; set; } public […]

为什么Azure Mobile Apps的数据模型中存在字符串ID?

我正在使用Azure移动应用程序中的C#来学习它们。 我创建了模型以链接到我的Azure SQL DB,创建了一个像这样的DataObject: public class Account : EntityData { //public int id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string PhoneNumber { get; set; } public string Password { get; set; } public DateTime dtCreated { get; set; } public Guid oGuid […]