Tag: azure

是否可以在一个ASP.NET MVC应用程序中同时具有Azure AD和个人帐户身份validation?

通过在Startup.Auth.cs文件中执行此操作,我有点成功 // Configure the db context and user manager to use a single instance per request app.CreatePerOwinContext(ApplicationDbContext.Create); app.CreatePerOwinContext(ApplicationUserManager.Create); app.Properties[“Microsoft.Owin.Security.Constants.DefaultSignInAsAuthenticationType”] = “ExternalCookie”; // Configure the sign in cookie app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { […]

如何使用OAuth 2.0对Azure Active Directory进行身份validation?

我有一个用C#编写的REST API,我需要使用现有的Azure AD服务进行身份validation。 我目前拥有希望进行身份validation的用户的用户名和密码。 我需要使用Azure AD进行身份validation,并从服务器接收访问令牌。 有人可以指点我解释如何做到这一点的一些文章/教程的方向?

无法找到程序集“Microsoft.SqlServer.Types”版本10或更高版本

我有个问题。 我无法将迁移添加到我的ASP.NET WebAPI 2项目中。 我收到错误: “此提供程序无法使用空间类型和函数,因为无法找到程序集”Microsoft.SqlServer.Types“版本10或更高版本。” 我知道有几个问题和答案,如: 在Azure上找不到“Microsoft.SqlServer.Types”版本10或更高版本 在ASP.NET中将字符串转换为DbGeometry时出现“空间类型和函数不可用”错误 但! 问题是… 我已经安装了Microsoft.SqlServer.Types。 我已经将Global.asax配置为: SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath(“〜/ bin”))到Application_Start中。 引用设置为本地副本> true。 NuGet包都已更新。 我已经尝试降级并升级包。 当我尝试运行Add-Migration v002时,这是完整的错误: System.InvalidOperationException:此提供程序无法使用空间类型和函数,因为无法找到程序集“Microsoft.SqlServer.Types”版本10或更高版本。 zh_cn System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly()zh_cn System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(String wellKnownText)zh_cn System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText)zh_cn System.Data .Entity.Migrations.Model.ColumnModel.CreateDefaultValue() zh_cn System.Data.Entity.Migrations.Model.ColumnModel..ctor(PrimitiveTypeKind type,TypeUsage typeUsage)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty属性,TypeUsage conceptualTypeUsUsage,TypeUsage defaultStoreTypeUsage,IDictionary 2 annotations) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty property, ModelMetadata modelMetadata, IDictionary 2 annotations) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer。 c__DisplayClass2e3.b__2df(EdmProperty p)zh_cn System.Data.Entity.Utilities.IEnumerableExtensions.Each [T](IEnumerable 1 ts, […]

Azurefunction角色,如停止Azure虚拟机的权限

我希望使用预定的C#Azurefunction管理一些Azure资源。 目前在我已经创建的命令行应用程序中,我一直在使用库“Microsoft.IdentityModel.Clients.ActiveDirectory”进行令牌授权,使用“Microsoft.Azure.Management.Compute”进行客户端调用以进行资源管理。 //… var credential generated my AD authentication and extending Microsoft.Rest.ServiceClientCredentials using (var client = new ComputeManagementClient(credential)) { client.SubscriptionId = “[SOME_SUBSCRIPTION_ID]”; client.VirtualMachines.BeginPowerOff(“[RESOURCE_GROUP]”, “[VM_NAME]”); } 我的管理客户端是否可以与Azure资源交互而无需提供凭据建立的用户凭据或密钥保密? 我以前的经验与AWS有关,而且我认为它混淆了我对Azure资源管理的看法。 我看过的旧post是: 启动和停止Azure虚拟机 和 是否可以从Azurefunction停止/启动Azure ARM虚拟机? -EDIT 1- 我希望基于具有各种权限的已分配角色,在AWS资源客户端中为Lambda提供类似于运行时凭据的内容。 我会看看证书。

当前请求是通过使用Azure部署的SSL进行的

context.Request.IsSecureConnection 即使通过HTTPS提供连接,始终在Azure部署中返回false。 在查看为Azure部署的站点发送的标头后,我发现: X-Forwarded-Proto=https 此标头是否保证与网站的客户端连接在HTTPS下,与context.Request.IsSecureConnection连接方式相同?

ASP.NET 4.5在ASP.NET Core 2.0应用程序下的Azure Web App中作为虚拟应用程序抛出502.5

这是“ 在ASP.NET核心网络应用程序下的虚拟目录中运行MVC Web应用程序.net 4.6.1。是否可能? ”但它没有解决,OP表示他通过创建一个额外的应用程序来解决它。 所以我再次发布。 我有一个Azure Web App组织如下: “site/wwwroot/MyWeb.dll” (ASP.NET Core 2.0) “site/admin/MyAdmin.dll” (ASP.NET 4.5) 网络运行正常。 但是当我尝试访问管理站点时,我收到以下错误 HTTP错误502.5 – 进程失败 以下是“… / logFiles / eventlog.xml”的摘录,我认为它很有用 1000 1 0 Keywords 1024919046 Application RD00155D77CB9A Application ‘MACHINE/WEBROOT/APPHOST/MYAPP/ADMIN’ with physical root ‘D:\home\site\admin\’ failed to start process with commandline ‘dotnet .\MyWeb.dll’, ErrorCode = ‘0x80004005 : 80008081. 随意询问您可能需要的任何信息。 提前致谢!

在Azure队列存储中传递对象消息

我正在尝试找到一种将对象传递给Azure队列的方法。 我找不到办法做到这一点。 正如我所见,我可以传递字符串或字节数组,这对于传递对象来说并不是很舒服。 无论如何将自定义对象传递给队列? 谢谢!

如何跟踪异步文件上传到azure存储的进度

有没有办法跟踪文件上传进度到Azure存储容器? 我正在尝试使用C#创建一个用于将数据上传到azure的控制台应用程序。 我的coode现在看起来像: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; using System.Configuration; using System.IO; using System.Threading; namespace AdoAzure { class Program { static void Main(string[] args) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse( ConfigurationManager.ConnectionStrings[“StorageConnectionString”].ConnectionString); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference(“adokontajnerneki”); container.CreateIfNotExists(); CloudBlobClient myBlobClient = storageAccount.CreateCloudBlobClient(); CloudBlockBlob myBlob = […]

是什么导致Azure事件中心ReceiverDisconnectedException / LeaseLostException?

我正在使用EventProcessorHost和一个IEventProcessor类(调用它:MyEventProcessor)从EventHub接收事件。 我通过在两台服务器上运行我的EPH,并使用相同的ConsumerGroup连接到Hub,但使用唯一的hostName(使用机器名称)将其扩展到两台服务器。 问题是:在白天/黑夜的随机时间,应用程序记录此: Exception information: Exception type: ReceiverDisconnectedException Exception message: New receiver with higher epoch of ‘186’ is created hence current receiver with epoch ‘186’ is getting disconnected. If you are recreating the receiver, make sure a higher epoch is used. at Microsoft.ServiceBus.Common.ExceptionDispatcher.Throw(Exception exception) at Microsoft.ServiceBus.Common.Parallel.TaskHelpers.EndAsyncResult(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 此exception与LeaseLostException同时发生,当它尝试检查点时,从MyEventProcessor的CloseAsync方法抛出。 (由于ReceiverDisconnectedException,可能正在调用Close?) 我认为这是由于Event Hubs在扩展到多台机器时的自动租赁管理而发生的。 但我想知道我是否需要做一些不同的事情,以使其工作更干净,避免这些例外? […]

Azure AD B2C – 角色管理

我有一个与Azure AD B2C连接的Asp.NET MVC应用程序。 在管理员设置中,我创建了一个管理员组: 在我的代码中我想使用[Authorize(Roles = “Administrator”)] 使用常规的Azure Active Directory,它很容易添加(只需3行代码)。 但对于Azure AD B2C,我无法在Web中找到任何有用的教程或示例。 也许你可以告诉我我需要修改什么。 这是我的Startup.Auth.cs的ConfigureAuth方法 public void ConfigureAuth(IAppBuilder app) { app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { // Generate the metadata address using the tenant and policy information MetadataAddress = String.Format(AadInstance, Tenant, DefaultPolicy), // These are standard OpenID Connect parameters, with values pulled from […]