2

It's my first time using Azure and i'm having problems.

I have a register and login script within my MVC project and it works fine on my local machine however when I try to use Azure I get this message on the page "An error occurred while processing your request."

I have allowed the IP in the firewall. I have linked the database with the site.

The project uses code first models. When I try to register it will create the table in the database but it will not input the users data. So all I'm left with is an empty table.

Also when I try to Deploy my database from Sql management studio it creates the tables but fails to input data.

What am I doing wrong?

EDIT:

So when I try to Deploy my database from SQL Management Studio this is the error I get during importing database

TITLE: Microsoft SQL Server Management Studio
------------------------------

Could not import package.
Warning SQL0: A project which specifies SQL Server 2012 as the target platform may experience compatibility issues with SQL Azure.
Error SQL72014: .Net SqlClient Data Provider: Msg 40511, Level 15, State 1, Line 2 Built-in function 'newsequentialid' is not supported in this version of SQL Server.
Error SQL72045: Script execution error.  The executed script:
ALTER TABLE [dbo].[Domains]
    ADD DEFAULT (newsequentialid()) FOR [DomainId];


 (Microsoft.SqlServer.Dac)

I think this is due to my model using GUID. Could this be what is causing all these issues with the database on Azure?

Community
  • 1
  • 1
  • What exect error message do you get when you try to Insert or Create someting? – Venson Dec 15 '14 at 00:28
  • Show some code, Jacob. – TarasB Dec 15 '14 at 00:30
  • I'm not sure what code to show you as I just realized any page that requires the database either for user login or something else causes the `An error occurred while processing your request.`. Everything works locally but not with Azure. – Jacob Gardner Dec 15 '14 at 00:50
  • Just googling "newsequentialid azure" gives a hint that you should switch to `uniqueidentifier/newid()` for your `DomainId` column. – TarasB Dec 15 '14 at 22:47

4 Answers4

2

The error message pretty much describes your problem:

Warning SQL0: A project which specifies SQL Server 2012 as the target platform may
              experience compatibility issues with SQL Azure.
Error SQL72014: .Net SqlClient Data Provider: Msg 40511, Level 15, State 1, Line 2 
                Built-in function 'newsequentialid' is not supported in this version of SQL Server.

SQL Server and Azure SQL are not 100% feature compatible (even the gap has been reducing quickly):

Currently, Azure SQL Database does not support all the features of SQL Server. For a detailed comparison information, see Azure SQL Database Guidelines and Limitations. Be aware of this when you want to move an existing database to Azure SQL Database as you might need some additional budget on database redesign.

So your problem is that you're using an unsupported feature newsequentialid.

user272735
  • 10,473
  • 9
  • 65
  • 96
1

Late last week Azure launched a preview of the latest version of Azure SQL DB and in that preview, NewSequentialID is now supported, along with many other features that were previously not available.

To create a database using the newest version, use the new portal at portal.azure.com and follow the guidance on-screen inviting you to use the preview edition when you create a new Azure Database.

Stuart Ozer
  • 1,354
  • 7
  • 7
  • I have tried this however when I click on the new version it just redirects to Microsoft's home page. – Jacob Gardner Dec 17 '14 at 20:28
  • Does it work for you if you try the SQL Database Update Preview link on this page: http://azure.microsoft.com/en-us/services/preview/ – Stuart Ozer Dec 18 '14 at 21:44
0

The short answer is, if all you need is just a unique Guid, just change all newsequentialid() into newid().

Here is a good reference blog post Uniqueidentifier and Clustered Indexes, published by Microsoft Azure team.

In the section concerning newsequentialid(), it describe the difference:

If the NEWID() function generates unique non-sequential uniqueidentifier than NEWSEQUENTIALID() function generates unique sequential uniqueidentifier. The only trick to NEWSEQUENTIALID() function is that the GUIDs are generated partial based on the network card of the computer.

Further, newsequentialid() is not even recommended because

(i)t is possible to guess the value of the next generated GUID and, therefore, access data associated with that GUID.

Blaise
  • 21,314
  • 28
  • 108
  • 169
-1

It's difficult to say what is going on without any code, but most likely you are forgetting to commit the entries to your table. SqlCommand.Dispose() before SqlTransaction.Commit()? might help you.

Community
  • 1
  • 1