LS2013 Core Project – How to deploy successfully

So we now have this very cool LightSwitch HTML app, with new Security Management and Tile screens. So big question is, how do we get this deployed and working successfully in the cloud. Well quite simple really. We’ll use Microsoft Azure as our provider for this section. Other providers won’t be much different than how you normally deploy. You do need to at least read this section as I show you how to deploy so the Security Management works.

Expectation is that you have an Azure account already or you’ll get a trial.

  1. Log into your Azure Portal
  2. Provision a new website with a database
  3. Grab the connection strings that are provided
  4. Now lets go to our solution in Visual Studio
  5. Change your Solution Configuration to Release
  6. Right click on your database project, properties
  7. Change the Target platform to be Windows Azure SQL Database
  8. Also, load up your PostDeployment1.sql script
  9. Now go ahead and do a fresh build
  10. Make sure you have your SecurityAdmin setup in your Web.config
  11. Right click on your LsCoreProject
  12. Select Publish
  13. In the Wizard
  14. Application type: Complete Application
  15. Application Server Configuration: Windows Azure
  16. Subscription: Select your subscription

    Quick note, Azure and Visual Studio seem to have issues at times. If you get an Unhandled Exception of type ‘System.InvalidOperationException’, it is not the end of the world. Close the exception. Open up, in Visual Studio, the Server Explorer. Expand Windows Azure, then expand Web Sites. You’ll be prompted to Log in. Enter your credentials and log in. Issue resolved. Restart your publish process.

  17. Service Type: Web Site
  18. Service Configuration, URL: lscoreprojectdemo
  19. Security Settings, Administrator: Configure to your liking
  20. Security Settings, HTTPS: Your preference
  21. Data Connections, Database conx: Should prepopulate
  22. Data Connections, Attached Sources: Here is the secret sauce!
  23. Assumptions are you are still using the same Admin security account
  24. If not scroll the text in the input box and change them. These credentials are not SQL credentials, but the Security Administrator account within your LightSwitch application.
  25. Remember we used as an example User: LeaveMeAlone
  26. You also need to remove the localhost:{port} and use your Azure URL
  27. Once you’ve done that, move to the summary
  28. Press publish and wait for the magic!

    Not to bad eh?

    Now load up your application with your Azure URL
    Go ahead and login with your LightSwitch Security Administration account credentials or register a new account

    Didn’t work?

    Azure has been flakey with LightSwitch apps. I have found that it does not seem to install the default Security Administration user that you predefined for deployment. That is until you create some other account. This is where the self register page takes care of this. Go ahead and navigate to /register.aspx of your URL and register yourself. As you see you will only get the one tile. That’s good. Security is working. Go ahead and log out and log back in now with the LightSwitch Security Administration account you had setup pre-deployment. You should see the Admin tile now. That’s good. Go ahead and create your accounts, etc. as needed. I have also seen this issue happen on standard IIS deployments. Why… Good question.

Next… Lets wrap it up


Here are the topics and their logical order:

  1. Create the project
  2. Add external CSS
  3. Add external scripts
  4. Update the default.htm
  5. Add LogIn/LogOut/Register/ChangePassword
  6. Create the security data source
  7. Screens for permissions
  8. Screens for role management
  9. Screens for user management
  10. Tables for tile menus
  11. Screens for icon management
  12. Screens for menu management
  13. Create a tile menu screen
  14. Create a database project
  15. — You
  16. Wrap up

4 thoughts on “LS2013 Core Project – How to deploy successfully

  1. mat says:

    Hi, thank you very much for this whole tutorial, it was very helpful !

    However, I’ve now published the application successfully but I’m having trouble using it.
    When I load the azure url in my browser, the page shows the azure default “this web app has been successfully created”, and when I enter [myurl]/register.aspx I get this runtime error:

    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Did I miss a step or configure something wrong ?

    Thank you!

  2. dwm9100b says:

    When you go to production.

  3. Miles says:

    Hi,

    Hopefully you can help. I’ve deployed to Azure but when accessing the security entities it returns an error. Value cannot be null. Parameter name: uriString

    I can hit the service directly through the browser after logging in and it will return the list of entities.

    Default
    -Permissions
    … etc

    However, when I try to access a specific collection (/formsSecurityData.svc/Permissions) it returns the above error.
    I’m using the LsWires version before the latest release.

    any ideas ?

    thanks,
    Miles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: