Base solution for your next web application
Open Closed

DEPLOYMENT IN AZURE #2382


User avatar
0
azirrazzak created

Hi,

We would like to deploy our ASP.NET Zero application in Azure. What are the best practices for doing that? Please guide us with the steps to publish all the projects to Azure.

Thanks much.

Regards, Azir Razzak


13 Answer(s)
  • User Avatar
    0
    joshyates created

    My major concern is database schema changes after my aspnetzero project is in production. Anybody with experience please advice.

    Thanks.

  • User Avatar
    0
    rvanwoezik created

    Visual Studio has a great feature, if you ad your Azure sql db in the SQL Server Object Explorer. You can compare database schema with your local sql db and update the schemes and also the data.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @azirrazzak, We don't have much experience on this area but I think you can easily publish from Visual Studio to your azure website. You also need to create a database and apply migrations to it while publishing.

    Hi @JoshYates,

    This actually depends on needs of your system. If your system tolerates a few minutes of blocking users accessing it, you can backup your DB and apply migrations. I think you already know that :).

    If you need a 7/24 running system, I don't have any experience on that, maybe someone else can help you.

  • User Avatar
    0
    Ricavir created

    Hello,

    I've been changing my template project following your step by step document (asp.net core + angular 2) I have a plan on azure and would like to deploy the project before going further in the developement. I manage to migrate the database without any problem (with Migrator project)

    I tried to deploy the web project directly from VS2015. All publish settings are automaticaly configured after logging to my azure account.

    After deployment process, I have an internal server error :"An error occurred while starting the application."

    Do I have to change some settings before publishing ? (on appsettings.json or web.config)

  • User Avatar
    0
    rvanwoezik created

    This tutorial helped me to publish an angular2 site to azure, hope this helps:

    [https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-nodejs-get-started])

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Ricavir,

    I recently published angular2 project to azure and I had some problems and fixed some of them.

    Yes, you need to set remoteServiceBaseUrl and appBaseUrl in your appconfig.json file under src/assets folder of angular2 app. You also need to add a web.config file to published azure directory which should look like this, because azure does not allow *.json files by default.

    <?xml version="1.0"?>
    
    <configuration>
        <system.webServer>
            <staticContent>
                <mimeMap fileExtension=".json" mimeType="application/json" />
            </staticContent>
        </system.webServer>
    </configuration>
    

    We have another problem related to signalr connection and we will fix it soon, please follow this isseue for that <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/47">https://github.com/aspnetzero/aspnet-ze ... /issues/47</a>.

    Thanks.

  • User Avatar
    0
    Ricavir created

    Tks for your answers @ismcagdas, @rvanwoezik.

    Actually, I did not manage to deploy the server part to azure. I know that some issues are ongoing to deploy angluar2 (client side)... But my point is just to deploy ASP.NET Core app to azure. Thus, I don't even have swagger UI accessible from azure.

    Right konw, I have a 500 server error.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    There should be detailed error message in Logs.txt under "/site/wwwroot/App_Data/Logs" folder, can you check that ?

  • User Avatar
    0
    Ricavir created

    Tks for the hint. It was a problem with azure database connection string. now, I can continue with angular deployment ;)

  • User Avatar
    0
    ismcagdas created
    Support Team

    Good news :). By the way, there is an issue related to signalr for angular2 template and we will fix it this week. Please follow this issue for that <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/47">https://github.com/aspnetzero/aspnet-ze ... /issues/47</a>.

  • User Avatar
    0
    brallierc created

    I tried publishing the AngularUI project from Visual Studio to Azure, all that gets uploaded is the web.config... any thoughts?

  • User Avatar
    0
    hikalkan created
    Support Team

    please see #2461

  • User Avatar
    0
    Ricavir created

    Hello, I applied these changes :

    <cite>ismcagdas: </cite> Good news :). By the way, there is an issue related to signalr for angular2 template and we will fix it this week. Please follow this issue for that <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/47">https://github.com/aspnetzero/aspnet-ze ... /issues/47</a>.

    Signalr is still not working on azure now (as well as on my dev server).

    Here is the log :

    ERROR 2017-02-13 12:53:55,740 [18 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL2K0GIR93AU": An unhandled exception was thrown by the application. System.Security.Cryptography.CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating. at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) at System.Security.Cryptography.DpapiDataProtector.ProviderProtect(Byte[] userData) at Microsoft.AspNet.SignalR.Infrastructure.DataProtectionProviderProtectedData.Protect(String data, String purpose) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessNegotiationRequest(HostContext context) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) at Microsoft.Owin.Cors.CorsMiddleware.HandleCorsRequestAsync(IOwinContext context, CorsPolicy policy, CorsRequestContext corsRequestContext) at Microsoft.Owin.Cors.CorsMiddleware.<Invoke>d__0.MoveNext()