Deploy Your LightSwitch Application As A DotNetNuke Module

DotNetNuke has long been generally known as considered one of the simplest and most powerful web content management frameworks.

Wireless Gold 3 Gang 1 Way Control Light Touch Switch 86

Combined with LightSwitch, the easiest solution to create data driven applications, you might have the flexibility to create and deploy “Line-Of-Businessapplications quickly and easily.

An important thing to notice, is that you can use your existing DotNetNuke users and roles with your LightSwitch applications.

This is admittedly important in case your already have accounts and roles.

You don’t need to require your users to learn a new username and password, and have to log into, each application.

Deploying your LightSwitch applications in DotNetNuke allows a seamless user experience.

What You Need:

– DotNetNuke 5 (using ASP.NET 4.0)
– LightSwitch Beta 2 (or higher)
– Visual Studio 2010 Standard (or higher)
– If you want to deploy your website on a Windows 7 machine, you want to have Windows Ultimate installed

Create the LightSwitch Application

Step one is to create a simple LightSwitch application that may track a user’s Tasks.

We wire-up the ‘Createdevent for the Entity.

and add a single line of code to the task_Created method, that may set the Username field to the “Application.User.Name

When this application is running inside of DotNetNuke, it’s Membership Provider will provide this username.

This is all that is required to integrate into DotNetNuke security.

In the Properties, ensure that the applying is using Forms Authentication.

Also be sure that it is set as a web application, hosted in IIS.

Next, from the Menu bar, we select Build, then Configuration Manager.

and set the configuration to Release. It will prevent the button for the screen designer from appearing on the deployed application.

We select Build, then Publish.

We then use the wizard to deploy the appliance.

Note: you possibly can download the Visual Studio LightSwitch Application at this link.

The DotNetNuke Site

To integrate the LightSwitch application right into a DotNetNuke site, we must first, do these things:

– Use the most recent version of DotNetNuke 5
– Run the location using ASP.NET 4.0

Now, we install the next module (at this link).

This module runs a script, that creates a table called ‘RolePermissionsthat LightSwitch expects to be part of the Membership Provider.

DotNetNuke uses a custom membership provider, and doesn’t use that table, but, it must be there or it’s going to throw an error.

The module also dynamically injects the .xap file and the JavaScript needed.

It contains the .xap utilized in this instance LightSwitch project, but you’ll be able to update the code to reference your personal .xap.

Next, we go to the deployed LightSwitch application and script out any tables which are a part of the appliance

(we do not script out the tables which might be part of the ASP.NET membership provider, so on this case we only script out the Tasks table).

While logged in as Host on the DotNetNuke site, we select Host, then SQL.

We run the script to create the table(s).

Next, we copy all of the folders and .dll’s from the “Bindirectory of the deployed LightSwitch application, to the “Bindirectory of the DotNetNuke website.

Copy the “Webfolder from the deployed LightSwitch application, to the foundation directory of the DotNetNuke website.

Remove the .xap file that’s within the “Webdirectory,

because it’s now in the “…\DesktopModules\LightSwitchModule\ClientBin\directory

(it was placed there after we installed “LightSwitchModule_01.00.00_Install.zip.

Copy the ClientAccessPolicy.xml file from the deployed LightSwitch application, to the root directory of the DotNetNuke website.

Update the DotNetNuke Web.config

First, backup the prevailing DotNetNuke Web.config file.

It may help to open the DotNetNuke site up in Visual Studio 2010 at this point because it can provide intellesense when making changes to the web.config.

Change:

To:

Add the following sections to the web.config:

On the _IntrinsicData key, ensure you replace set this to the same settings because the SiteSQLServer Connection string with the value of the existing SiteSQLServer key.

While logged into your DotNetNuke site because the Host or an Administrator, place the LightSwitchModule on a page in your DotNetNuke site.

The module will now work.

Trouble Shooting

(note: don’t send me a private email asking for help. It should go unanswered because there is no way for me to assist everyone personally. Please post to the forums. Thank you!)

For those who get the Load operation failed for query ‘GetAuthenticationInfo The remote server returned an error: NotFound. error :

LightSwitch is getting an error when it’s trying to go to this address:

http://Your DotNetNuke Site/DesktopModules/LightSwitchModule/ClientBin/Microsoft-LightSwitch-Security-ServerGenerated-Implementation-AuthenticationService.svc/binary/GetAuthenticationInfo

If you happen to go to that address and get the next error:

IIS specified authentication schemes ‘IntegratedWindowsAuthentication, Anonymous’, however the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings in order that only a single authentication scheme is used.

You need to follow the direction on this page to resolve it:

http://msdn.microsoft.com/en-us/library/x8a5axew.aspx

Note: In case you are running this on a machine using the Windows 7 operation system, you Must have Windows 7 Ultimate for this to work, period. For a proof, see this post.

NOTE: Please see Easy DotNetNuke LightSwitch Deployment, for an easier method to make use of LightSwitch in a DotNetNuke website

7 comment(s) so far…

Is there _any_ way you may fix the formatting to eliminate the horizontal scrolling? The post is rather unreadable.

@Jonathan – Because these are web.config keys that should be correct, I didn’t need to risk putting in line breaks. I agree that the scrolling is painful 🙁

Other than DotNetNuke 5 and ASP.NET 4.0, are there other requirements on the server?
Is DotNetNuke 6 OK? Is IIS 7.0 OK? Is SQL Server 2008 R2 OK? (These are what my
hosting provider has available, together with ASP .NET 4.0.) Clearly for now, there is no
direct LightSwitch deployment option for DoNetNuke. In your deployment example’s
“LightSwitch Publish Application Wizard” screen image, you show the data base as
“(local)/LightSwitch,” which I take to be local to your development machine. Is identical
true with IIS? Is that deployment local or does that go directly to the DotNetNuke host?
I want to clearly understand what’s “local” and what will not be, in response to your example.
Do you think your DotNetNuke deployment example will work with any hosting provider
that claims they fully support DotNetNuke? What about hosting providers that only allow
“medium trust” levels, which is typical. I am using a shared Go Daddy hosting account and
haven’t any access to admin, executables, root configuration files, or the underlying server for
that matter (which is typical of shared hosting). I only see my alloted IIS website space.
Please let me know if LightSwitch, and your DotNetNuke deployment method is for my
situation.

@LarryT – Have a look at the method used at: http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/29/Easy-DotNetNuke-LightSwitch-Deployment.aspx

Michael,

Do you’ve a VB version of your sample? We’ve got successfully built upon your C# sample and got things working in a new environment and was wondering whether a VB equivalent was available.

Many Thanks,
James Black
Intechrity

@James Black – Sorry no VB version.

Re: Deploy Your LightSwitch Application As A DotNetNuke Module

Michael,
I’ve tried to construct the appliance using Visual Basic after which C# using your instructions on this page.

Once i copy everything over I get this error:

Model loading failed. There isn’t any ApplicationDefinitionLoader within the composition.
Inner exception message:
There is no ApplicationDefinitionLoader in the composition.

I have done a trace and it isn’t showing anything.

Are you able to think of anything different that you did for your sample app? I can get that to work and i can do advanced extensions to it. However, our company policy is VB and we might really like to get this working.

admin

Leave a Reply

Your email address will not be published.