Tag: azure

Azure Notification Hubs templateName的用法

我已经创建了一个带有Cordova的示例应用程序和一个与Azure通知中心通信的Mvc5应用程序。 注册由后端处理,因为标签必须是安全的。 我们使用了从后端注册的三种不同的模板,用于iOS,WP8和Android平台; 后端可以使用sendtemplatenotificationasync发送带有$message有效负载的推送通知。 它工作但我们没有使用templateName 。 从您的app后端文档中读取注册 ,我发现了这个: “您可以使用注册的TemplateName属性来识别模板”。 一旦我使用templateName成功创建了注册,我该怎么办? 我希望找到一个API发送方法,除了标签或标签表达式之外,还能指定一个特定的templateName ; 我还没有找到这样的东西。 templateName的含义和一般用例是什么?

Azure存储计算的MD5与现有属性不匹配

我正在尝试通过ashx传递Azure存储blob。 在blockBlob.DownloadToStream(memoryStream)上抛出以下exception: Microsoft.WindowsAzure.Storage.StorageException: Calculated MD5 does not match existing property 我知道它找到了正确的blob。 如果我放入一个不存在的容器和路径,那么它会给我一个404exception。 我已经用Google搜索了可能导致此错误的提示,但没有任何有用的信息。 有没有人对可能导致这种情况的原因有任何想法? 在过去的几天里,我以不同的方式重写了这段代码,但它总是在DownloadToStream上消失。 using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; public void ProcessRequest(HttpContext context) { // Retrieve storage account from connection string. Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting(“StorageConnectionString”)); // Create the blob client. CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); // Retrieve reference to a previously created […]

从用于Google API的Azure网站中的p12证书生成X509Certificate2时出现502错误

我正在使用此GoogleJsonWebToken类生成一个访问令牌,用于对Google Calendar API的json调用。 当我使用以下内容(使用我的实际服务帐户电子邮件)时,它在我的开发机器上的IIS Express中运行得非常好: string p12Path = HttpContext.Current.Server.MapPath(“~/App_Data/certificate.p12”); var auth = GoogleJsonWebToken.GetAccessToken(“uniquestring@developer.gserviceaccount.com”, p12Path, “https://www.googleapis.com/auth/calendar”); string Token = auth[“access_token”]; 为了测试这个,我只是在我的cshtml razor视图中调用@Token 。 当我将其发布到我的Azure网站时,它不起作用。 如果我保持GoogleJsonWebToken类未经修改,我会得到一个非常无益的502 – Web server received an invalid response while acting as a gateway or proxy server. 没有其他信息。 在一些谷歌搜索后 ,我发现这个SOpost是一个类似的问题。 所以我尝试了他们的解决方案我得到System.Security.Cryptography.CryptographicException: The system cannot find the file specified. 何时从我的Azure网站运行。 从我的开发机器运行时,我得到System.Net.WebException: The remote server […]

生产中的Azure SDK 2.2:无法加载文件或程序集“msshrtmi”或其依赖项之一。 该系统找不到指定的文件

我已经在StackOverflow和其他站点上的其他几个线程上读到过这个问题。 其他解决方案都没有解决我的问题,而且大多数已经过时,引用了旧版本的Azure SDK。 我有一个典型的Azure网站角色部署到Azure,使用Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener来记录跟踪消息。 当发生跟踪时,似乎DiagnosticMonitorTraceListener正在使用RoleEnvironment类,而后者又尝试加载显然不存在的msshrtmi.dll 。 以下是在Azure中记录到文件系统的堆栈跟踪的一部分: [FileNotFoundException: Could not load file or assembly 'msshrtmi, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() +0 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() +747 [TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.] Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() +0 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +23 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34 [ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, […]

CloudConfigurationManager与WebConfigurationManager?

在Azure网站中,我总是使用以下代码从配置的应用程序设置中获取一些值: string property = WebConfigurationManager.AppSettings[“property”]; 就在几天前,我在CloudConfigurationManager上遇到了麻烦,有了它,我可以得到这样的属性: string property = CloudConfigurationManager.GetSetting(“property”); 虽然CloudConfigurationManager似乎更适合云使用,但我从来没有遇到任何WebConfigurationManager问题。 我应该使用CloudConfigurationManager吗? 两者有什么不同? 在什么情况下,CloudConfigurationManager将表现出不同的行为 WebConfigurationManager?

如何使用Linq查询Azure存储表?

我不知道到底在哪里,但我对此有错误的想法。 我试图在第一个实例中使用linq查询azure存储表。 但我无法弄清楚它是如何完成的。 从各种来源看我有以下几点: List blogs = new List(); CloudStorageAccount storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(“BlogConnectionString”)); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); CloudTable blogTable = tableClient.GetTableReference(“BlogEntries”); try { TableServiceContext tableServiceContext = tableClient.GetTableServiceContext(); TableServiceQuery query = (from blog in blogTable.CreateQuery() select blog).AsTableServiceQuery(tableServiceContext); foreach (BlogEntry blog in query) { blogs.Add(new BlogViewModel { Body = blog.Body }); } } catch { } 在我搞砸之前,我可能已经把它靠近了。 […]

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/ 但是移动服务和移动应用程序之间似乎存在一些差异,如果有人指出我正确的方向,我真的很高兴,也许有一个可用的例子

如何使用C#在Azure Data Lake store中复制文件

我正在尝试将文件从一个文件夹复制/移动到azure数据湖中的另一个文件夹。 业务需要创建动态文件夹并移动/复制文件。 如何使用c#做到这一点?

迁移到Azure后性能大幅下降

目前,我们正在开展云迁移项目,我们对此进行了以下更改: SQL Server 2014到Azure SQL PaaS Redis缓存[Windows移植]到Azure Redis PaaS 从共享驱动器到Azure文件服务的静态文件 实现了数据库交互的瞬态故障处理。 HttpSessionState已从SQL Server更改为自定义[Redis PaaS] 应用程序有两个使用相同数据库的Web应用程序: 一个内置经典的点网编码模型与网络forms。 使用dot net MVC4构建的另一个应用程序。 在我们将应用程序从现有Rackspace环境[每个具有4GB RAM的2台服务器]移动到Azure并运行负载测试并收到以下结果之后: MVC4应用程序的速度要快一些。 Web-Form应用程序开始表现不佳,负载相同,响应时间从0.46秒增加到45.8秒。 内存使用率相同,数据库利用率约为30%-40%, CPU利用率接近100%(所有Web服务器)的1100个并发用户(在Rackspace,它为4500个并发用户提供服务)。 我们测试了应用程序2 D5 azure服务器VM ,RAM更高,CPU更快。 任何人都可以突出显示如此剧烈的性能下降(一个应用程序执行几乎相同,其他一个执行几乎100倍的速度)是可能的? 注意:有一点观察,即使在停止负载测试30分钟后,CPU利用率也保持在100%。 然后它迅速下降。