Q & A
Which tools & SDK version should I use for .Net Backend?
You should use the last stable version:
How to avoid assemblies load when the .Net project is updated?
The Azure Mobile Services – .Net Backend uses different Nuget packages and it is not recommended to update all Nuget available in “Update” windows from “Manage Nuget Package”. We should only update Microsoft Azure Mobile Services .NET Backend Entity Framework Extension Nuget package. If something went wrong you should uninstall all packages and then install
For more information see this article.
Which Nuget package should I use if I want to use Azure Storage?
You can use the Microsoft Azure Mobile Services .NET Backend Azure Storage Extension, to avoid this kind of errors:
“Found conflicts between different versions of the same dependent assembly ‘Microsoft.WindowsAzure.Storage’: 18.104.22.168. Please change your project to use version ‘22.214.171.124’ which is the one currently supported by the hosting environment.”
Can I define a Dev and Prod environments?
Yes, you can. To create different environments using the same code you can use transform file as described in this article.
Can I run my services in localhost?
Yes, you can. In development you should use first localhost and after the tests are ok, you can publish it to the Azure. This way, you are not doing “call APIs” to your Azure Mobile Services. For more information see this article (Running the service in localhost).
Can I use a local SQL Server database when the services are running in localhost?
Yes, you can. In local development you can use a local SQL Server database but you must be aware that there are few difference between SQL Azure database and SQL SQL Server database.
Can I use a SQL Azure database when the services are running in localhost?
Yes, you can. To use a SQL Azure database in localhost you must allow your IP to access the database, and this configuration must be done in Azure Portal (in the database separator). For more information see this article (Defining the allowed IP for the database).
How I can see the WebConfig file published in Azure?
To see the WebConfig file published in Azure you should use Kudo. For more information see this article.
How to see the log files in server?
In Azure Portal, it is possible to see the logs from the selected Azure Mobile Service (in Logs separator), but for some reason is need to see the log files, you should use Kudo to get it. For more information see this article and in this article (How to see details about errors).
How can I write my logs?
In you service, you should have a property called Services, provided for example by TableController, which has a property called Log and this way is possible to write logs, and is possible to define the type Error or Information.
Is possible to debug my code which is running in Azure?
Yes, you can deploy to Azure and is possible to debug that version, this way each request by the client application can be catch by the remote debugger. For more information see this article.
How should I manage images in Azure Mobile Services?
In Azure Mobile Service you should not send the image to the backend. You should not save in your SQL Database and you should save all images, videos, etc, in Blob Storage. This way, you need notify the Backend about it and the Backend will provide the information required to upload the image to the blob storage. See more information in Upload images to Azure Storage by using Mobile Services.
Why CreateAt, UpdateAt and Version are null in my requests?
These properties are called “system properties” and the client application can request it doing something like
var q = todoTable.CreateQuery();
items = await q.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();
Or using the solution provided in: Using the new system properties of Azure Mobile Services Tables from a client application.
Should I use model & dtos or should expose model as dtos?
It depends of the application requirement, but in general it is preferred to use model & dtos because in some cases there are information in database which cannot be public or shared outside, this way dtos only expose the information we need.
Samples to help developers to use Azure Mobile Services.
Microsoft Azure Mobile Service: How to create the Azure Mobile Service in Azure Portal
This article aims to show how to create an Azure Mobile Service in the portal and how to create the Visual Studio 2013 Project.
Microsoft’s Windows App Studio Beta: Connecting a Menu App to Azure Mobile Service
This article aims to connect the Menu App from Windows App Studio with Azure Mobile Service, using .Net back end. It includes the main point each developer must know:
- Analysis the model;
- Create a table controller (a service)
- Validate data
- Overview about DomainManager class, EntityDomainManager class
- The Entity Framework’s context
- Database (connection string, defining the allowed IP for the database, migration, seed)
- Running the service in localhost
- Publish and run the service in Azure
- How to see errors
- Remote debug