问题描述
我正在尝试使用 Azure Fluent API 创建一个新的 SQL Server (https://github.com/Azure/azure-sdk-for-net/tree/Fluent) 但我总是收到 Microsoft.Rest.Azure.CloudException.其他一切(创建存储帐户、应用服务、资源组)工作正常 - 只是 SQL 部分不起作用.
I'm trying to create a new SQL Server with the Azure Fluent API (https://github.com/Azure/azure-sdk-for-net/tree/Fluent) but I always get a Microsoft.Rest.Azure.CloudException. Everything else (Creating Storage Account, App Services, Resource Groups) works fine - it's just the SQL part which does not work.
ISqlServer sqlServer = await Azure.SqlServers
.Define(serverName)
.WithRegion(regionName)
.WithExistingResourceGroup(rgName)
.WithAdministratorLogin(administratorLogin)
.WithAdministratorPassword(administratorPassword)
.WithNewElasticPool(elasticPoolName, elasticPoolEdition)
.CreateAsync();
但是在尝试创建服务器时出现异常:
But when trying to create the server I got an exception:
{Microsoft.Rest.Azure.CloudException: Invalid value for header 'x-ms-request-id'. The header must contain a single valid GUID.
at Microsoft.Azure.Management.Sql.Fluent.ServersOperations.<CreateOrUpdateWithHttpMessagesAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Sql.Fluent.ServersOperationsExtensions.<CreateOrUpdateAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Sql.Fluent.SqlServerImpl.<CreateResourceAsync>d__53.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Creatable`4.<Microsoft-Azure-Management-ResourceManager-Fluent-Core-ResourceActions-IResourceCreator<IResourceT>-CreateResourceAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.CreatorTaskItem`1.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.TaskGroupBase`1.<ExecuteNodeTaskAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at XircuitAPI.Controllers.AzureSqlServerController.<Create>d__9.MoveNext() in C:UsersThimoBuchheisterDocumentsCodeXircuitxircuitXircuitAPIControllersAzureSqlServerController.cs:line 235}
推荐答案
好的,我已经解决了我的问题,在使用 fiddle 跟踪我的 http 请求后,我发现 Application Insights 向我对 AAD 应用程序的请求添加了标头.所以我完全删除了 Application Insights 并重新上线.希望对你有帮助.看这个.如果您想继续使用 Application Insight,请查看禁用应用程序洞察
Okay i have solved my problem, after using fiddle to trace my http request i discovered that, Application Insights added headers to my request to the AAD app. So i total removed Application Insights and im back online. Hope it helps you. Look at this. if you want to continue using Application Insight check this outdisable application insight
这篇关于Azure Fluent API 创建 SQL Server 时出错 - 缺少 x-ms-request-id 标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!