标签: azure-sql-database

如何将具有独立数据库的Web应用程序转换为具有单个数据库的云?

我在C#上运行了一个电子商务应用程序.这个应用程序的每个实例现在都拥有它自己的:

  1. IIS 7应用程序池
  2. IIS 7网站
  3. SQL Server 2008数据库

我的合作伙伴告诉我,我们需要抛弃这种方法并迁移到云端.似乎SQL Azure每个数据库收费.因此,采用这种方法对我们来说是非常昂贵的. 有没有办法可以使用单个巨型数据库而无需重新编写整个数据访问层? *或者有一种廉价的方式来拥有数百个小型SQL Azure数据库?*

注意:每个数据库只有大约20 MB

cloud azure azure-sql-database

5
推荐指数
1
解决办法
530
查看次数

当我在Azure管理门户中登录到主数据库时,“只能在主数据库中授予创建数据库权限”

我想CREATE DATABASE在SQL Azure Server中向特定用户授予权限。我进入windows.azure.com,登录,在左窗格中选择“数据库”,登录到数据库admin帐户下的“主”数据库,选择“新建查询”- master: Query(Untitled1.sql)出现带有标题的窗口。

我打过

将数据库创建到THATUSERLOGIN;

然后按执行,查询结果是

CREATE DATABASE权限只能在master数据库中授予。

我究竟做错了什么?我该怎么做?

sql-server azure azure-sql-database

5
推荐指数
1
解决办法
7282
查看次数

获取错误参数'nameOrConnectionString'不能为null,为空或仅包含Azure数据库的空格

我在azure云存储上使用我的数据库和其他存储.我正在使用实体代码首次使用但问题是当我尝试使用CloudConfigurationManager.GetSetting()从云存储中读取连接字符串时,我收到以下错误:

错误:参数'nameOrConnectionString'不能为null,为空或仅包含空格.EntityFramework.dll中出现"System.ArgumentException"类型的异常,但未在用户代码中处理

这是我的Azure项目:Demo.Web.Azure

它有2个配置文件:

1)ServiceConfiguration.Cloud.cscfg:

<Role name="Demo.Web">
 <Setting name="MyConnectionString"
 value="Server=----;Database=DemoEntity;User ID=---;Password=---&amp;w;Trusted_Connection=False;
Encrypt=True;MultipleActiveResultSets=True;" />

  <Setting name="Demo.Storage"
 value="DefaultEndpointsProtocol=https;AccountName=---;AccountKey=------"
 />
Run Code Online (Sandbox Code Playgroud)

2)ServiceConfiguration.Local.cscfg:

<Role name="Demo.Worker">
  <Setting name="Demo.Storage"
 value="DefaultEndpointsProtocol=https;AccountName=---;AccountKey=------"
 />
Run Code Online (Sandbox Code Playgroud)

3)ServiceDefinition.csdef中:

<ServiceDefinition name="Demo.Web.Azure" schemaVersion="2014-06.2.4">
      <WebRole name="RepuGuard.Web" vmsize="Small">
         <ConfigurationSettings>
                  <Setting name="MyConnectionString" />

                  <Setting name="Demo.Storage" />
                 </ConfigurationSettings>

     </WebRole>

 <WorkerRole name="Demo.Worker" vmsize="Small">
                <ConfigurationSettings>
                  <Setting name="MyConnectionString" />

                  <Setting name="Demo.Storage" />
                 </ConfigurationSettings>

 </WorkerRole>

</ServiceDefinition>
Run Code Online (Sandbox Code Playgroud)

这是我的Context文件,它读取数据库连接字符串:

public partial class MyDemoDBContext : DbContext, IDisposable
    {
           public ObjectContext Context { get; set; }
           public MyDemoDBContext()
            : base(CloudConfigurationManager.GetSetting("MyConnectionString"))//Getting Error here
           {
             Context = …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc entity-framework azure azure-configuration azure-sql-database

5
推荐指数
1
解决办法
8465
查看次数

数据库"master"中的SQL Azure VIEW DATABASE STATE权限被拒绝

当我执行以下查询时:

SELECT * FROM sys.dm_io_virtual_file_stats(NULL, NULL)
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Msg 262,Level 14,State 1,Line 4 VIEW DATABASE STATE权限在数据库'master'中被拒绝.消息297,级别16,状态1,行4用户无权执行此操作.

但我能够使用配置的(由SQL Azure门户网站)管理员用户执行此查询.

我无法为我创建的任何用户授予查看数据库状态(使用配置的管理员用户),我收到以下错误:授予者没有GRANT权限.

任何想法如何能够执行查询

SELECT * FROM sys.dm_io_virtual_file_stats(NULL, NULL)
Run Code Online (Sandbox Code Playgroud)

来自配置(由SQL Azure门户)管理员用户以外的用户?

sql-server azure azure-sql-database

5
推荐指数
1
解决办法
8018
查看次数

是否可以编辑Azure自动化计划?

我已为Azure自动化Runbook创建了一个计划,并将计划链接到Runbook.但是我注意到无法编辑计划,甚至删除计划.我可能会遗漏一些东西.似乎可以创建自动化计划.请注意,我不是在谈论Azure Scheduler及其"Job Collections"等.

非常感谢任何建议.谢谢.

azure azure-automation azure-sql-database

5
推荐指数
1
解决办法
3883
查看次数

如何从Visual Studio中的包管理器控制台调用针对SQL Azure的update-database?

我使用的是EF 6.1.3.我试图从包管理器控制台调用update-database对SQL Azure.使用本地SQL Express 2012,一切正常.我可以使用SQL Server Management Studio 2012/2014和具有相同凭据的Visual Studio Server Explorer成功连接到服务器.我已从管理门户网站上对SQL Azure防火墙进行了例外但我收到错误:

错误号码:18456,状态:1,类:14用户'xxxxxxx'登录失败.已为此会话分配了跟踪ID"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".在需要帮助时,请将此跟踪ID提供给客户支持.

例外是:

System.Data.SqlClient.SqlException(0x80131904):用户'xxxxx'登录失败.已为此会话分配了跟踪ID"xxxxxx".在需要帮助时,请将此跟踪ID提供给客户支持.在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,UInt32的waitForMultipleObjectsTimeout,布尔allowCreate,布尔onlyOneCheckConnection,DbConnectionOptions USEROPTIONS,DbConnectionInternal&连接)在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1重试,DbConnectionOptions USEROPTIONS, DbConnectionInternal oldConnection,DbConnectionInternal&连接)在System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(的DbConnection outerConnection,DbConnectionFactory connectionFactory的,TaskCompletionSource 1 retry, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1重试,DbConnectionOptions USEROPTIONS)在System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource 1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1重试)在System.Data. System.Data.Entity.Infrastructure.Interception.InternalDispatch中的System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b__36(DbConnection t,DbConnectionInterceptionContext c)中的SqlClient.SqlConnection.Open()ER 1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2的操作,TInterceptionContext interceptionContext,动作3 executing, Action3中执行)在System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open在System.Data.Entity.SqlServer.SqlProviderServices(的DbConnection连接,DbInterceptionContext interceptionContext).<> c__DisplayClass33.b__32()在System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<> c__DisplayClass1.b__0()在System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute [TResult](Func键1 operation) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) at System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action1个动作)在System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection (的DbConnection SqlConnection的,动作 …

c# entity-framework azure azure-sql-database

5
推荐指数
1
解决办法
1108
查看次数

实体框架数据库初始化:初始化新Azure SqlDatabase时超时

我有一个ASP.NET MVC应用程序.通过CustomerController创建新客户时,我运行新的后台任务(使用HostingEnvironment.QueueBackgroundWorkItem)为该客户创建新的Azure SqlDatabase.

我使用Entity Framework Code First来创建/初始化新数据库.这是代码:

// My ConnectionString
var con = "...";

// Initialization strategy: create db and execute all Migrations
// MyConfiguration is just a DbMigrationsConfiguration with AutomaticMigrationsEnabled = true
Database.SetInitializer(strategy: new MigrateDatabaseToLatestVersion<CustomerDataContext, MyConfiguration>(useSuppliedContext: true));

using (var context = new CustomerDataContext(con))
{
    // Neither 'Connection Timeout=300' in ConnectionString nor this line helps -> TimeoutException will rise after 30-40s
    context.Database.CommandTimeout = 300;

    // create the db - this lines throws the exception after ~40s …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc azure ef-code-first azure-sql-database

5
推荐指数
1
解决办法
2485
查看次数

Azure SQL:应用Index Advisor会改变影响EF迁移吗?

我在我的MVC网站和Azure SQL后端使用EF 6 Code First.Azure门户SQL页面包含许多可以通过单击应用的索引建议.但是,我不确定对我的EF数据模型的影响.我知道如果我直接在数据库中添加或删除表,字段等,那么EF会抱怨我的模型和数据库不同步而且事情变得糟糕.索引怎么样?如果我让Azure自动添加推荐的索引,EF甚至会知道吗?它会引起问题吗?

sql-server asp.net-mvc entity-framework azure azure-sql-database

5
推荐指数
1
解决办法
319
查看次数

删除数据库范围的凭据

我在Azure中有一个数据库,需要移动到本地数据库。

我使用SSMS导出.bacpak文件,然后连接到本地版本的Sql Server并尝试将其导入。

导入开始,但此行失败

Create database scoped credential...
Run Code Online (Sandbox Code Playgroud)

此功能在Azure中可用,但在Sql Server 2014中不可用(将于2016年提供)。

为了解决该问题,我去了Azure数据库并使用SSMS删除了凭据。

因此,该凭证在SSMS中不再可见。

然后,我创建了一个新的导出,并尝试导入它。但是我收到相同的错误消息。换句话说,即使脚本已从数据库中删除,该脚本仍在尝试创建凭据。

我还需要执行其他操作来完全删除凭据吗?我已经尝试了几次导出/导入,只是为了确保没有导入原始文件,但是我确定事实并非如此。是否有一个紧凑的命令或需要运行的命令来完全清除对数据库的更改?

sql-server azure-sql-database

5
推荐指数
1
解决办法
2516
查看次数

SSIS:当使用Azure密钥存储区中的CMK插入始终加密表时,ODBC提供程序出现错误

我正在尝试使用SSIS(Visual Studio 2017)将数据插入到Azure SQL表中,该表具有通过Always Encrypted加密的列以及存储在Azure Key Vault中的列主键,但是我一直遇到错误。

根据在其他帖子中找到的建议,我正在将ADO.NET目标与ODBC数据提供程序一起使用。该用户是在Azure SQL数据库中配置的Azure Active Directory用户,因此可以登录。它具有在密钥库的访问策略中授予它的所有关键特权。

我的ODBC连接字符串如下所示:

DRIVER=ODBC Driver 17 for SQL Server;SERVER=[dbs].database.windows.net;UID=[uid@example.com];PWD=[password];Authentication=ActiveDirectoryPassword;DATABASE=[database];ColumnEncryption=Enabled;KeyStoreAuthentication=KeyVaultPassword;KeyStorePrincipalId=[uid@example.com];KeyStoreSecret=[password]
Run Code Online (Sandbox Code Playgroud)

我希望将其插入表中,但是会导致此错误:

[ADO NET目标[2]]错误:在数据插入过程中发生了异常,从提供程序返回的消息是:错误[CE269] [Microsoft] [SQL Server的ODBC驱动程序17] [SQL Server]错误12038发送请求到https:// [keyvault] .vault.azure.net:443错误[CE263] [Microsoft] [用于SQL Server的ODBC驱动程序17] [SQL Server]验证ECEK签名时出错。错误[CE202] [Microsoft] [用于SQL Server的ODBC驱动程序17] [SQL Server]密钥存储提供程序AZURE_KEY_VAULT无法解密ECEK https:// [keyvault] .vault.azure.net:443 / keys / [cmk] / RSA_OAEP的[版本]。

我能够通过SSMS以及自定义控制台应用程序成功插入到表中,并验证加密是否按预期工作。该错误仅发生于SSIS。

odbc ssis azure-sql-database azure-keyvault always-encrypted

5
推荐指数
1
解决办法
121
查看次数