Tag: azure

Azure移动服务C#不会返回子实体

我真的用新的基于C#的Azure移动服务打砖墙了,它也非常简单:(我不能为我的生活得到查询操作来返回子属性值。我有todo项目的默认项目修改如下: public class TodoItem : EntityData { public TodoItem() { this.Numbers = new Collection(new List { new TodoItemNumbers{Value = 1}, new TodoItemNumbers{Value = 2}, new TodoItemNumbers{Value = 3}, new TodoItemNumbers{Value = 4}, new TodoItemNumbers{Value = 5}, }); } public virtual ICollection Numbers { get; set; } public string Text { get; set; } public bool […]

使用ImageResizer的Azure C#WebJob未正确设置Content-Type

我正在使用Azure WebJob来调整新上传的图像的大小。 resize有效,但新创建的图像没有在Blob存储中正确设置其内容类型。 相反,它们列在application / octet-stream中。 这里处理resize的代码: public static void ResizeImagesTask( [BlobTrigger(“input/{name}.{ext}”)] Stream inputBlob, string name, string ext, IBinder binder) { int[] sizes = { 800, 500, 250 }; var inputBytes = inputBlob.CopyToBytes(); foreach (var width in sizes) { var input = new MemoryStream(inputBytes); var output = binder.Bind(new BlobAttribute($”output/{name}-w{width}.{ext}”, FileAccess.Write)); ResizeImage(input, output, width); } } […]

在Windows Azure上部署WCF服务

只是为了澄清我是第一次用azure工作。 几个月前我用SQL Server连接创建了一个Restful WCF服务。 我在IIS上使用SQL Server Express 2012上的数据库部署了WCF。该服务没有问题。 [OperationContract] [WebGet(UriTemplate = “feed/{ID}/{Rating}/{Feed}”, ResponseFormat = WebMessageFormat.Json)] string feed(string ID, string Rating, string Feed); 现在我必须将WCF服务移动到Azure。 问题是我不知道如何将WCF部署到azure,如果甚至可以将WCF部署到azure。 数据库已移至azure。

在Azure网站上保存/提取文件的位置?

我有用于运行我们数据的unit testing的Web应用程序,我想将其部署为Azure Web站点。 问题是在这个应用程序我正在下载相当大的zip文件,提取它们(~50MB,内部500个文件)并对这些文件进行一些测试 。 我应该在Azure网站上将这些大文件保存在哪里以及我应该在哪里提取它们? 在localhost上我一直在使用“Path.GetTempPath()”,但Azure网站报告此文件夹中没有空间,即使我的Azure站点总共有1000MB,大约990MB可用。 有没有办法如何使用这1000MB的文件操作? 如果无法做到这一点,我应该为提取的文件使用Azure Blob存储吗?

PUT和Delete不能与Windows Azure上的ASP.NET WebAPI和数据库一起使用

我正在使用基本的CRUD操作开发ASP.NET WebAPI项目。 该项目在本地运行,并在Windows Azure中有一个示例数据库。 到目前为止,Http GET和POST工作正常,给我200和201.但我正在努力与DELETE和POST。 我更改了Web.config中的处理程序,删除了WebDav,但这些都没有用。 同时启用CORS和[AcceptVerbs]等各种属性也不起作用。 知道我做错了什么吗? 提琴手原始输出: HTTP/1.1 405 Method Not Allowed Cache-Control: no-cache Pragma: no-cache Allow: GET Content-Type: application/json; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.0 X-AspNet-Version: 4.0.30319 X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcTWFyY1xPbmVEcml2ZVxEb2t1bWVudGVcRmlcVnNQcm9qZWt0ZVxONTIwMTQwODI1XE41XE41XGFwaVxwcm9kdWN0XDEwODM=?= X-Powered-By: ASP.NET Date: Sun, 14 Sep 2014 15:00:43 GMT Content-Length: 75 {“Message”:”The requested resource does not support http method ‘DELETE’.”} Web.config文件: 控制器: public […]

交换Azure Web App部署槽会注销ASP.NET Core RC2中的所有用户

每当我更新作为Azure Web App运行的ASP.NET Core RC2网站时,它都会注销所有用户。 这似乎与将暂存部署槽交换到生产相关(我使用从VS到登台的Web部署,并将其设置为自动交换到生产)。 如果我直接更新生产槽,那很好,但我不想这样做。 我不知道如何配置这个,帮助将不胜感激! 这是我现在如何配置它,我的网站只允许直接登录(没有Facebook登录等): 在Startup中的ConfigureServices中 // found some post that said this would help… doesn’t seem to work… services.AddDataProtection() .SetApplicationName(“myweb”); services.AddIdentity(options => { options.Cookies.ApplicationCookie.CookieDomain = settings.CookieDomain; // cookie domain lets us share cookies across subdomains options.Cookies.ApplicationCookie.LoginPath = new PathString(“/account/login”); options.Cookies.ApplicationCookie.ReturnUrlParameter = “ret”; options.Cookies.ApplicationCookie.CookieSecure = CookieSecureOption.Never; // TODO: revisit site-wide https […]

如何通过AADvalidationAzure服务管理请求

我尝试了3种没有结果的方法: 根据这篇文章https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx我在AAD注册了新的Web应用程序,具有访问Azure Service Management API的权限(步骤1-9)并编写建议的两行代码来获取令牌: var context = new AuthenticationContext($”https://login.windows.net/{tenantId}”); var result = context.AcquireToken(“https://management.core.windows.net/”, clientId, new Uri(redirectUri)); ,但它失败,但例外: Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException was unhandled Message: An unhandled exception of type ‘Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException’ occurred in Microsoft.IdentityModel.Clients.ActiveDirectory.dll Additional information: AADSTS90014: The request body must contain the following parameter: ‘client_secret or client_assertion’. Trace ID: aa2d6962-5aea-4f8e-bed4-9e83c7631887 Correlation ID: f7f1a61e-1720-4243-96fa-cff182150931 我也尝试过: var context = […]

用户或管理员未同意使用该应用程序 – 发送此用户和资源的交互式授权请求

我们正在做这个 CRM Web API项目。 该项目登录到Dynamics CRM在线实例并获取帐户列表。 登录似乎正在发生。 但是,帐户列表会出现以下错误: AADSTS65001:用户或管理员未同意使用ID为“xxxx-xxxxx-xxxx-xxx”的应用程序。 发送此用户和资源的交互式授权请求。 跟踪ID:e3b360d6-39fb-4e61-87d9-26531f30fd7b相关ID:9b2cff0c-074e-44fe-a169-77c8061a7312时间戳:2016-10-18 10:12:49Z 权限已正确设置 : 问题是什么?

通过代码调用时获取Powershell命令的输出

我编写了一段代码(在C#中),使用System.Management.Automation执行Powershell脚本(特别是Azure PowerShell)。 powershell脚本基本上在Azure上的容器中上传vhd,当通过azure Powershell手动输入命令时,该容器显示上载进度和经过的时间等。 通过代码一切正常但我想在命令执行期间获得命令的结果/输出(即上传进度,时间已过去)(即pipeline.invoke(); )这里是代码: RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create(); Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration); runspace.Open(); RunspaceInvoke scriptInvoker = new RunspaceInvoke(runspace); Pipeline pipeline = runspace.CreatePipeline(); Command myCommand = new Command(scriptPath); foreach (var argument in arguments) { myCommand.Parameters.Add(new CommandParameter(argument.Key, argument.Value)); } pipeline.Commands.Add(myCommand); var results = pipeline.Invoke(); // i want to get results here (ie during command execution) […]

Azure网站中的站点无法处理X509Certificate2

我在Azure网站(不是托管服务)中有网站,我需要在那里处理带有私钥的.pfx证书。 var x509Certificate2 = new X509Certificate2(certificate, password); 但我面临以下例外: System.Security.Cryptography.CryptographicException: The system cannot find the file specified. at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags) 在文章http://blog.tylerdoerksen.com/2013/08/23/pfx-certificate-files-and-windows-azure-websites/我发现它发生是因为默认情况下系统使用用户的本地目录存储密钥。 但Azure网站没有本地用户配置文件目录。 在同一篇文章中,作者建议使用X509KeyStorageFlags.MachineKeySet标志。 var […]