Story Details for tools

MvcInstaller for .Net 4 and 4.5 with VS 2012

kahanu
Author:
Version:
1.1.1
Views:
43441
Date Posted:
10/19/2012 11:38:57 AM
Date Updated:
10/19/2012 11:38:57 AM
Rating:
5/4 votes
Framework:
ASP.NET MVC 4
Platform:
Windows
Programming Language:
C#
Technologies:
MvcInstaller
Tags:
asp.net mvc 4, mvcinstaller, visual studio 2010, visual studio 2012, azure
Demo site:
Home Page:
Share:

Note: this version of MvcInstaller is recommended to be used with SecurityGuard.Mvc4.  If you don't you will most likely experience the exception about "ExtendedMembershipProvider".  See Issues at the bottom of this article for more information.

MvcInstaller for .Net 4.0 and 4.5

I've made some changes to MvcInstaller for these versions of the .Net Framework, mostly to address the new System.Web.Providers namespace that is used instead of the older System.Web.Security namespace.

This new version is also now available via NuGet.

nuget command

If you've heard of this new namespace, then great, if not then there's plenty of articles floating around about it.  For me, I am definitely a fan of this new namespace.  It does everything I need it to do for Membership and profile purposes and it's in a sleeker package.  No SQL Server Views or Stored Procedures.  Everything operates with Linq.  For me this is a big "Yay!"

Here's a good starter article by Scott Hanselman.  http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx

Here's a look at the new System.Web.Providers database schema.

System.Web.Providers database schema
There's no table name prefixes (aspnet_).  They are a lot cleaner.  For those who used the WebEvent table, you'll need to make that yourself unfortunately.

Special Note

This version of MvcInstaller is an enhanced version of the Mvc3 version.  Some of the description has not been repeated here, so you may want to read that article first to get the basic information.

Also, MvcInstaller updates your web.config file.  This is to make your life easier.  Here's what gets modified:
  1. ConnectionString section - one or two connection strings will be added to your application based on whether you are using the Entity Framework.  One connection string will be for the Entity Framework related connection string, and the other will be used by the Membership system.
  2. AppSettings - a new key will be added call "AppInstalled".  It will have a value of "false" which will tell MvcInstaller that it is OK to run.  Once MvcInstaller is executed and runs successfully, it will remove this key and prevent MvcInstaller from being executed again.  This is a security feature to prevent others from accidentally or maliciously re-installing the application again.

No other sections are updated in the web.config.  If you don't want your web.config to be modified, then you should not use MvcInstaller!

What is MvcInstaller?

For those of you who haven't used MvcInstaller for MVC, I'll recap.  MvcInstaller is a little NuGet package that helps you install your MVC application on a staging or production server quickly and easily.

It can also install the complete ASP.NET Membership system in your database along with your application's database schema and seed data.  And it can do it literally in 10 seconds or less.

How it works

When you install the NuGet package it installs a bunch of files that you use to configure your installation.  The primary file you will work with is the installer.config file.  It's an xml file where you enter your settings for database connection, application name, and other things that are pertinent for the Membership system, if you so desire to have it installed.

It will also add a new key to the appSettings section.

<appSettings>
...
   <add key="AppInstalled" value="false" />
</appSettings>

This key tells MvcInstaller it's OK to execute.  If it's gone (or true) then it tells MvcInstaller that it has already executed and MvcInstaller removes this key.  When this key is removed, it prevents the /Install view from being shown.  This is a security measure to prevent accidental re-installation of the database.

When you configure the installer.config file with your database connection information, you can then deploy your compiled MVC application to any server to have it installed.  Simply FTP it to the server, navigate to the /Install view and you will see a page that displays the settings in the installer.config file.  But it won't show the passwords or any other sensitive information.  This way you can install it in front of someone without concern that they may see your passwords.

Once you click the "Install" button, it will do the following:

  1. Build the connection string section for you
  2. Place the Membership values from the settings file into the Membership sections
  3. Do some basic validation before executing
  4. If it validates, it will create the Membership database, if you want it created
  5. It creates Users and Roles and assigns the Users to the Roles
  6. It will create your database from the SQL files you provide
  7. That's it!

Be sure to watch the video demonstration to get a better idea of how it works.

IMPORTANT NOTE!!! One thing I should point out is that at the moment it only works with Forms Authentication.  I have not yet tested it to work with Windows Authentication.  That is on my TODO list, I just haven't found time.

What's New?

There are a number of things I've done with this version to accommodate both .Net 4.0 with VS 2010 MVC applications, and .Net 4.5 with VS 2012 MVC applications.  Here's a quick list:

  • Include provider "types" in default installer.config file
  • Add new SessionState section in installer.config file
  • Generate Membership web.config sections with the new System.Web.Providers namespace
  • Detect default conventions in VS 2012 and handle appropriately

Here's a look at the new installer.config file.

01.<?xml version="1.0" encoding="utf-8" ?>
02.<InstallerConfig>
03.  <ApplicationName>MyCoolApplication</ApplicationName>
04.  <Path>
05.    <RelativeSqlPath>App_Data</RelativeSqlPath>
06.  </Path>
07.  <Membership Create="true" ProviderName="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
08.  <Profile ProviderName="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
09.  <RoleManager ProviderName="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
10.    <Roles>
11.      <Role Name="Administrator">
12.        <Users>
13.          <User UserName="admin" Password="password" Email="me@info.com" SecretQuestion="Favorite Color" SecretAnswer="Mauve" />
14.          <User UserName="bizuser" Password="93o404u" Email="ninjaburp@aol.com" SecretQuestion="Favorite Movie" SecretAnswer="Saturday Night Fever" />
15.        </Users>
16.      </Role>
17.      <Role Name="Manager">
18.        <Users>
19.          <User UserName="joemanager" Password="mypassword" Email="jmanager@myemail.com" SecretQuestion="Dog's Name" SecretAnswer="Thor" />
20.        </Users>
21.      </Role>     
22.      <!--<Role Name="SecurityGuard">
23.        <Users>
24.          <User UserName="admin" Password="password" Email="me@info.com" SecretQuestion="Favorite Color" SecretAnswer="Mauve" />
25.        </Users>
26.      </Role>-->
27.    </Roles>
28.  </RoleManager>
29.  <SessionState ProviderName="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
30.  <Database UseTrustedConnection="true" EntityFrameworkEntitiesName="MyCoolEntities">
31.    <ConnectionStringName>MySampleConnection</ConnectionStringName>
32.    <DataSource>localhost</DataSource>
33.    <InitialCatalog>MyCoolDb</InitialCatalog>
34.    <UserName>mycooldbadmin</UserName>
35.    <Password>mycooldbpassword</Password>
36.  </Database>
37.</InstallerConfig>

You'll notice that each of the Membership elements now have the "type" attributes set to the default for this new namespace.  MvcInstaller will insert these values directly into your web.config Membership sections for you, along with any other pertinent data.

Note: MvcInstaller updates your web.config Membership sections!

Again MvcInstaller takes the values from the installer.config file and updates your web.config file for you.  It only makes these modifications to make your life easier and to make sure they are setup correctly to work with your application. 

It updates the connectionString section and the membership sections by updating the connectionStringName and applicationName attributes.

NOTE: all the changes made by MvcInstaller are completely modifiable by you afterward.  And there is nothing done to your web.config that is proprietary to MvcInstaller.  Everything done is standard .Net protocols.

How to Deploy to Server

Deployment to your production or staging server is easy, it's as simple as just FTP'ing your site to the server.  But there are some things to know to make sure you haven't missed something.

1)  If you have used MvcInstaller to configure your Membership database on your local development server, then you need to make sure you update your appSettings section to add back in the "AppInstalled" key.

<appSettings>
...
    <add key="AppInstalled" value="false" />
</appSettings>

MvcInstaller needs this key to exist in order to execute, AND it needs to have a value of "false", meaning the app has not been installed.  This will allow MvcInstaller to display the /Install view.

2)  Update the installer.config.  Make sure you've updated the production version of the installer.config file to reflect the settings for your production SQL Server database connection information.  These values will update the web.config/ConnectionStrings section on the production server, as well as the Membership sections, so you don't want to leave the development settings in there.

3)  Compile your MVC application with the new installer.config and web.config modifications as described above, then copy the application to the server, either via FTP or some other method.

4)  Modify the permissions for the site to allow for Write permissions. This is only needed during MvcInstaller execution for it to update the web.config file.  Once it's updated, you can revert the permissions back.

5)  Once the application is on the server, open it in a browser and make sure you can see the home page, and then navigate to http://www.yourdomain.com/Install.  The MvcInstaller view should appear with the settings for your production database.  Confirm all the settings are correct and click the button to execute.

Everything should run successfully!

If you get an error, you can post it here and I'll try to help you fix it as much as possible.

Handle VS 2012 projects

In VS 2012 MVC projects, the web.config file is void of the Membership sections, that's because it is using a new Membership system based on the SimpleMembershipProviders.  This I'm not such a big fan of just yet, but more on that later.

Since VS 2012 projects use this new namespace means it also uses a new database schema, one that is radically different than previous.  There are also new means for initialization and activation which I'm finding difficult to use in a custom scenario.

Here's a look at this database schema:

SimpleMembership database schcema
I don't really have a problem with the new schema or it's intentions, which is to allow for other platforms such as Azure, etc., I just find a lack of helpful documentation on how to use it in non-"default" scenarios, disappointing.

For these reasons I've tested MvcInstaller using the .Net 4.0 SQL Server schema used by the System.Web.Providers namespace and they all work perfectly.  So until I figure out what the hell I'm doing with this new SimpleMembershipProviders namespace, I will be installing the Membership database with the System.Web.Providers namespace.

I hope to be figuring this out soon so I can release a version of MvcInstaller specifically for VS 2012 to use the SimpleMembershipProviders namespace.

My Take on the SimpleMembershipProviders Integration

My initial complaint with this is that I can't get it to work quickly and easily outside of the default scenario, despite the fact that I have a 500 IQ.

Seriously though, I'm going to reserve my real feelings about this new framework until I do some more investigation, but at first look, it feels to me that Microsoft may have dropped the ball with this one.  Again mostly because I can't find reliable documentation on the providers.

Some of my complaints are:

  • it seems to be tightly-coupled with a DbContext. 
  • new hoops to jump through to create the database schema
  • in-code connection string initialization
  • LazyInitializer?  What?

There may be more, but my eyes are glazing over at the moment thinking about this.  ;^)  But really, these are just my complaints, they are not yet objections since I don't know enough about how this new framework works to object that strongly.

Conclusion

For the time being MvcInstaller for .Net 4.x will be using the System.Web.Providers namespace and database schema.  Don't expect to use it right now with the new SimpleMembershipProviders namespace.  That version will be coming soon, hopefully.

I've tested this a number of times in both VS 2010 and VS 2012 with both frameworks and got it working.  Please help me out and post any bugs you may find here so I can make it better.

Also this works with the companion package: SecurityGuard.Mvc4

Setup Azure for MvcInstaller.Mvc4 installation

This is information provided by Pratheek Khoosal on how to use MvcInstaller.Mvc4 with Windows Azure.

The following are steps to take to prepare Azure for the web site and deployment:

  1. When creating the Azure website, use the custom create as illustrated
    Azure database setup
    This will create the Azure database and website link
  2. Once the website and database have been created. Select the relevant database, this in turn will make available the database management features. Select the Manage allowed IP address option.
  3. Allow your current client IP address to manage the database
  4. From the Azure website management interface use the select the Download publish profile option to your local machine
  5. In Visual Studio right click your project in the solution explorer, select the Publish option, using this option publish the website using the downloaded file from the previous step

Use MvcInstaller to install database to Azure

These are the instructions to use MvcInstaller.Mvc4 to install the database on Azure.

  1. I setup MvcInstaller, exactly as I would locally except I changed my database connection string to point to the Azure database, in the installer.config

    <Database UseTrustedConnection="false" EntityFrameworkEntitiesName="entityFramework">
      <ConnectionStringName>MySampleConnection</ConnectionStringName>
      <DataSource>xxxxxxx.database.windows.net</DataSource>
      <InitialCatalog>xxxx_db</InitialCatalog>
      <UserName>user@xxxxxxx</UserName>
      <Password>password</Password>
    </Database>
    All the text in italics is what I changed
  2. I then ran the application on localhost changed the url to install and installed the application as if I am installing it locally.

What this did was connect to the Azure Db and install all the relevant database compontents and users.

I hope this helps users to plan on using it with Windows Azure.


Possible Issues

Issue:

To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".

Resolution:

This error is usually seen after installing MvcInstaller.Mvc4 and then trying to Register or Login a user.  Since MvcInstaller.Mvc4 uses the System.Web.Providers namespace for Membership, and the VS 2012 projects use the Membership system based off of the SimpleMembershipProvider namespace, you will see this exception.

This is due to the fact that clicking the Register or Login links will point to the Account controller which initializes the SimpleMembershipProvider with the InitializeSimpleMembership attribute.  And the SimpleMembershipProvider inherits from the ExtendedMembershipProvider class. 

MvcInstaller.Mvc4 updates the web.config membership sections to use the System.Web.Providers namespace and this causes the conflict.  You need to point to a controller that does NOT use the SimpleMembershipProvider namespace.

The Easy fix is to simply install my SecurityGuard.Mvc4 NuGet package and update the LoginPartial view to point to the SGAccount controller.  Everything will work.

The other option is to create your own provider that inherits from ExtendedMembershipProvider and remove the membership sections in the web.config.  Although, this hasn't been tested so you're on your own for now.

My Suggestion: install SecurityGuard.Mvc4.


==== Update for Version 1.1.1 ====

  • Changed the link to SecurityGuard in the /install/index.aspx view from /SGAccount/LogOn to /SGAccount/Login to match the changes made in SecurityGuard.Mvc4.

Comments

  • glennbignell@yahoo.co.uk
    Posted By: Glennb
    On: 10/26/2012 6:07:22 PM

    Hi there, any idea why i'm getting this screen when trying to run package when integrated into an mvc4 project?

  • info@kingwilder.com
    Posted By: King Wilder
    On: 10/26/2012 6:55:34 PM

    @Glennb - you probably meant to post this on the SecurityGuard article, not the MvcInstaller article, but off-hand I don't know why you are getting this exception.

    It shows version 1.0.0.0.  You should install SecurityGuard.MVC4 version 1.04.  So uninstall this version and install that one and see if that fixes the problem.

    Let me know.

  • glennbignell@yahoo.co.uk
    Posted By: glennb
    On: 10/27/2012 2:32:40 PM

    Hi, this is what I installed from nuGet:


    I'm starting out with MVC so not really sure what I'm doing yet, so it's probably something I have done. Basically so far I have created a new project from the MVC4 internet template and downloaded SecurityGuard.MVC4. I have changed the link in _LayOut.cshtml to SGAccount etc. As soon as I hit register I get the error. Have I missed something?

  • info@kingwilder.com
    Posted By: King Wilder
    On: 10/27/2012 3:17:54 PM

    @Glennb - hmmm, I don't know what the problem could be.  Just curious, have you looked at the video on SecurityGuard?  It shows how to install and use it.  Maybe you are missing a step somewhere.

    I'll double check things on my end.  I'll let you know if I found anything.

  • info@kingwilder.com
    Posted By: King Wilder
    On: 10/27/2012 4:02:24 PM

    @Glennb - I just created a new VS 2012 project using MvcInstalller.Mvc4 and SecurityGuard.Mvc4 and everything worked as expected.

    The only issue I have to fix is the "Compare" attribute in the ChangePassword and Register ViewModels.  I'll do that in the next release.

    But everything else worked as it should.  Can you try to uninstall SecurityGuard completely, and then re-install it and see if that works?

  • glennbignell@yahoo.co.uk
    Posted By: glennb
    On: 10/28/2012 4:20:52 PM
    Hi, I'm still having no joy with getting it to work. I have built a VM and done a fresh install of VS 2012 Pro to see if that will work. MVCInstaller works fine, I get a connection and can see the users in the DB but as soon as I install SecurityGuard and nav to sgaccount/register it throws up the error. I'll let you know if I get to the bottom of it in-case others get the same problem. Have to say though that I'm out of ideas..... Maybe I am missing something in the initial setup of VS but i'm accepting the defaults so nothing i'm installing is causing it. Anyway i'll let you know.
  • info@kingwilder.com
    Posted By: King Wilder
    On: 10/29/2012 11:37:36 AM

    @Glennb - I'm sorry you are having all these problems.  I'll do what I can to help you get this sorted out. 

    If you click the "Login" link (/SGAccount/Login), do you get the same exception, or is it just with the Register link?  You shouldn't have to re-install VS 2012.

    I've built and tested this with VS 2012 Pro and the ASP.NET MVC 4 Internet template only, no other templates.  Is this what you have used also?

    Is it possible to write down the steps you use from creating a new Visual Studio project to when you get this error, including installing MvcInstaller and SecurityGuard?

    I'm pretty sure any Visual Studio installation is fine, nothing special needs to be done with VS to get this to work.  These are just NuGet packages that plug into your application.

  • rprocel@mcgplc.com
    Posted By: rob
    On: 10/30/2012 12:24:50 PM

    I was hoping you could help me out, I have used the mvcinstaller.mvc4 but I am now getting the following error when trying to register/login. I am using VS 2012:

    To call this method, the "Membership.Provider" property must be an
    instance of "ExtendedMembershipProvider".

  • info@kingwilder.com
    Posted By: King Wilder
    On: 10/30/2012 1:19:53 PM

    @rob - yep, you're right.  I need to update this article... because of the new Membership provider incorporated into the VS 2012 projects that is built off of SimpleMembershipProvider, the best way to use MvcInstaller is with my other NuGet package SecurityGuard.Mvc4.  Take a look at that article and video and you'll most likely want to install it.

    The option is to create your own Membership provider that inherits from ExtendedMembershipProvider to make this work without using SecurityGuard.

    If you use MvcInstaller.Mvc4 and SecurityGuard.Mvc4, I bypass the use of the SimpleMembershipProvder framework because it will take some more investigation to figure out the best way of incorporating this new framework into my NuGet packages.  So in the meantime I use the System.Web.Providers namespace, which is a step up from the original System.Web.Security namespace.

    So bottom line, install SecurityGuard.Mvc4, make the few modifications to your LoginPartial view and you're all set.

    I hope this helps.

  • glennbignell@yahoo.co.uk
    Posted By: glennb
    On: 10/31/2012 6:08:05 AM

    Hi King,

    Just letting you know I got it working. I have no idea what I did wrong but I started again and triple checked everything I was doing and now it all works. Thanks for your help/time. Keep up the good work.

  • info@kingwilder.com
    Posted By: King Wilder
    On: 10/31/2012 12:05:52 PM

    @Glennb - sorry about your adventures, but I'm glad you got it working.  If you ever figure it out, let me know so I can include it in possible issues.

    Thanks.

  • pkhoosal@gmail.com
    Posted By: Pat
    On: 1/8/2013 10:52:05 AM

    Hi King

    Thanks for both the MvcInstaller.MVC4 and SecurityGaurd.MVC4, they are both excellent. 

    I have been able to successfully implement them both on a standard MVC4 application. 
    But currently I am attempting to deploy my application to Azure, unfortunately I am have challenges with the install functionality. What seems to be my stumbling block is the fact that with Azure, the application is not allowed to update the web.config file as on a traditional file system. Any suggestions on a work around for this?

    You input would be greatly appreciated


    Thanks

  • info@kingwilder.com
    Posted By: King Wilder
    On: 1/8/2013 11:08:22 AM

    @Pat - hi, unfortunately I have not tested this with Azure yet. 

    You might try this: if you haven't already, run MvcInstaller locally to have it create the web.config settings using the connection settings for Azure.  You would need to create a new database for this, but you can name a database that is close such as MyDatabase1, if the original is MyDatabase. 

    Then simply rename the connection string settings back to the proper name of the database.  Then move the entire application with the pre-configured web.config to Azure, and try to run it.

    It may work, but still return an error message when it can't remove the appSettings/AppInstalled node.  But if it creates the database correctly and populates the data, then you can simply remove that key from the appSettings and everything should work.  If it doesn't even create the database, then this functionality isn't allowed either on Azure. 

    When I have time, I'll have to see what functions can and cannot be done with Azure.

    This is all hypothetical since I haven't had time to use Azure yet, but theoretically it should work.  If it still doesn't work, then you'll have to use other methods to deploy your site to Azure.

    I'd love to hear any results you have with this.

    Good luck.

  • pkhoosal@gmail.com
    Posted By: Pat
    On: 1/10/2013 6:27:34 AM

    Hi King

    I have gotten it to work. 

    Here's what I did:

    1. I setup MvcInstaller, exactly as I would locally except I changed my database connection string to point to the Azure database, in the installer.config

      <Database UseTrustedConnection="false" EntityFrameworkEntitiesName="entityFramework">
        <ConnectionStringName>MySampleConnection</ConnectionStringName>
        <DataSource>xxxxxxx.database.windows.net</DataSource>
        <InitialCatalog>xxxx_db</InitialCatalog>
        <UserName>user@xxxxxxx</UserName>
        <Password>password</Password>
      </Database>

    All the text in italics is what I changed

    2. I then ran the application on localhost changed the url to install and installed the application as if I am installing it locally.

    What this did was connect to the Azure Db and install all the relevant database compontents and users.

    Thanks

  • info@kingwilder.com
    Posted By: King Wilder
    On: 1/10/2013 11:24:41 AM

    @Pat - Hmmm, very smart! I'm glad you got it to work, because I was hoping it would work with Azure. When I have a moment I will play with Azure and see if there's a work-around so that it can actually be run on the Azure platform.

    Do you mind if I update the article to show your Azure solution?  Can I post your full name and/or your email?  If so, you can post it here or email it to me at "info at kingwilder.com".

    Thanks,

    King Wilder

  • pakisrlosers@gmail.com
    Posted By: pakiman
    On: 4/12/2013 9:58:03 PM
    Of course, It doesn't work.  Pathetic garbage.
  • info@kingwilder.com
    Posted By: King Wilder
    On: 4/13/2013 1:15:55 AM

    @pakiman - sorry you are having trouble with it.  I use it with every application I build and it works without issues. 

    Can you describe the problems you are having?  Have you watched the video on MvcInstaller?

    I'd like to find out what your issues are so I can address them properly.

  • momo@momo.com
    Posted By: momo
    On: 4/25/2013 12:50:37 PM

    Major installation issues where you fuck with the application web.config without any warning and then prevent updating the correct settings with an unhandled exception something like: shit was already added...

  • info@kingwilder.com
    Posted By: King Wilder
    On: 4/28/2013 10:36:34 AM

    @momo - I'm sorry you found issues with MvcInstaller.  If you watched the video it states that it will update the web.config based on the installer.config settings.  I'll update the article to make that clearer.

    MvcInstaller doesn't prevent you from updating your application after it's been setup.  It just does one-time modifications to save you manual work and to configure the settings so it will work with MvcInstaller.  You still have complete control over modifying your application as you always do.

    Can you tell me what it did that you did not want to occur?  Please be as specific as possible.  I want to address all issues and try to have them fixed.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/22/2013 10:31:02 AM

    I love SecurityGuard! I don't have the need to build my own, I just need good security. Thanks.

    I'm just having trouble with the \Install process on my hosting server.

    Steps: I created a VS2012 MVC4 project. Ran MvcInstaller.MVC4. Updated the Installer.config with my database info. Ran a build. Published to my dev site. Updated the access to the folder on my site to FULL and tried to run \Install.  The page opened and I thought I was in the clear, then I pressed the Install button and it said "Processing...please wait" for maybe 5 seconds. Then it stopped. No tables were created. I'm not seeing anything in the log, either.

    I looked in the browser console using Firebug, and it gives me a "NetworkError: 500 Internal Server Error - http://dev.mywebsite.com/Install/Run" error.

    Do I need to install  SecurityGuard  before I publish?  

    I've tried locally and it works great!

    I would appreciate any help you can give. Thanks!

  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/22/2013 8:24:49 PM

    @ewillingham - No you don't need to do anything with SecurityGuard.  MvcInstaller and SecurityGuard are completely separate applications, and I've just made it so they CAN work together, but they work independently also.

    Off hand, there's not enough information for me to make a proper assessment of the situation.  Do you have a /Reset folder inside the /App_Data folder?  If not, then create one and then try installing again.  In that version of MvcInstaller, not having the /Reset folder should not be an issue, but we can try it anyway.

    Can you tell me if your web.config was modified?  Have the connection strings been created for you by MvcInstaller and were the Membership sections also updated?  If not, then there is still a Write permissions issue.

    Let me know.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/23/2013 8:28:57 AM
    Adding the folders was all I need.  Visual Studios Web Deploy doesn't move everything to the host.  I will see if there is a way that I can make sure those folders are created on the host.  Thanks very much! 
  • Eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/24/2013 3:54:53 PM

    So I thought I had it all figured out, so I tried it again to make sure and I got the following Error:

    Error creating Role: The provider did not return a ProviderManifestToken string.

    Any help would be great! Thanks.

  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/24/2013 4:49:19 PM
    @ewillingham - where are you getting this error?  When you run the /Install procedure?
  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/27/2013 8:36:01 AM

    When I \Install. I'm trying to perfect the installation on the hosting site I'm using, so I can use it often. I really like it.  Just working out the bug with my hosting service.

    Do you have any logging that I could enable on the server?

  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/27/2013 11:53:14 AM
    @ewillingham - for logging I would suggest installing the ELMAH NuGet package.  It's super easy to install and has various ways of producting logs.
  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/27/2013 1:21:13 PM
    Awesome! Thanks.
  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/29/2013 11:58:10 AM
    Everything working well, except...for some reason I cannot login as admin.  I didn't update the email address, so I can't use the forgot password function.  What about the secret questions/answer? How can I enable that to work?
  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/29/2013 12:03:31 PM

    @ewillingham - why can't you login as admin?  Can't you use the original email address you used when you installed it?  I don't understand.

    Look at the installer.config file.  It will have the credentials for the admin.

    To get the secret question and answer to work, change the setting in the Membership section of the web.config.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/29/2013 12:39:11 PM

    I try to login and it says 'This account does not exist. Please try again.'.  I left the generic email address in there by mistake.

    I'll just start over again.  It's not a production app.

    Thanks.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/29/2013 12:39:11 PM
    Do you have a tutorial for the email? It's still not working.
  • Eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/29/2013 2:13:26 PM
    It was the Forgot Password process that changed my password (after I forgot which one I used), now I'm locked out. I would be nice if the process wouldn't change the password until the link in the email is pressed. 
  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/29/2013 2:16:17 PM

    @ewillingham - I don't have a solution for the issue regarding the message that the account does not exist.  I don't know what you did during installation.  Starting over is probably the best solution.  Have you watched the video on this?

    Regarding your next post on the email tutorial?  There is no email component to MvcInstaller.  There is for SecurityGuard, but it's using the default SMTP settings in the web.config.  Did you enter your mail server settings correctly?  Everything needs to be correct, including the Port number.

  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/29/2013 2:22:03 PM

    @ewillingham - the Forgot Password feature emails you the newly created password, but I guess it went to the wrong email address. 

    It wouldn't work with the scenario that you describe, since you have to log in with the new password.  If you have an email with a link, when do you see the newly created password in order to log in with it?  This is all by design.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 5/29/2013 2:32:56 PM

    I think I have the STMP mail setup correctly, but I'm not receiving any email.  Is there a way to see if the application is throwing an error? would it be in the log>

  • info@kingwilder.com
    Posted By: King Wilder
    On: 5/29/2013 2:50:45 PM

    @ewillingham - the only thing I can think of is either use ELMAH and check the logs, or use Firebug and see what the message is.  If you have secure email, you'll need to enable ssl.

    <network enableSsl="true" host="smtp.gmail.com" port="587" userName="some-email@gmail.com" password="valid-password" />

  • NicNash08@gmail.com
    Posted By: NicNash
    On: 8/2/2013 5:55:39 PM

    Hi, thank you so much for making this it looks really useful and powerful.  Have you tested it on the latest visual studios and asp.net mvc project?  

    Despite trying multiple paths, I run into an error somewhere.  One such error is when clicking 'install'

    Error creating Role: The provider did not return a ProviderManifestToken string.

    In the examples you show you use an sql express server, but I have not found a way to use it with a file.  Even creating a db on azure has given me issues.  I will keep trying!

  • info@kingwilder.com
    Posted By: King Wilder
    On: 8/5/2013 11:27:18 AM

    @NicNash - I have never seen this error before, but you can try this link to see if it helps.  http://stackoverflow.com/questions/4741499/how-to-configure-providermanifesttoken-for-ef-code-first.

    Also I don't recommend it for SQLExpress and I don't see where I have examples of that.  This is built primarily for SQL Server Standard and higher.

    Regarding use MvcInstaller with Azure, have you looked at the example toward the bottom of this post?  Be aware I have not formally tested it with Azure, so there are no guarantees that it will work with it, but that example shows how one developer was able to make it work.

    I hope this helps.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 8/15/2013 8:26:23 AM
    I love MvcInstaller and would like to use it on my Windows Azure websites.  I'm just not sure how to make sure the the app_data folder is published to the site and that I have write permission to it. Can I create it manually? Set Permissions manually? Please help!
  • info@kingwilder.com
    Posted By: King Wilder
    On: 8/15/2013 9:57:12 AM

    @ewillingham, the section at the bottom of this post demonstrates how to use MvcInstaller with Azure. I personally haven't used Azure yet, but this explanation should work.

    The app data folder should move along with your compiled app as long as its included in your VS project, that is if Azure doesn't ignore it. Why do you need to set permissions on the app_data folder? Try the explanation and let me know if it works for you.

  • eric.willingham@gmail.com
    Posted By: ewillingham
    On: 8/15/2013 10:41:38 AM
    The instructions in the post worked, but it's not very elegant.  Are there any plans to have another version of MvcInstaller? I would be willing to help improve the package.
  • joe@data-flow.co.uk
    Posted By: DataFlowJoe
    On: 12/11/2013 3:28:12 PM

    Hi there, King Wilder.... what an honour to be talking to royalty! :-) 

    I'm quite excited to get this up and running, I have followed your very clear instructions to the letter. I've created the standard ASP MVC4 website using VS 2102, I've installed both nuget packages for MVC4 and I've gone through all the settings you refer to in the instructions, meticulously. I've deployed it to my dedicated online server and it opens to the home page without any hitch. I enter the install url and ticked the 'use securty guard box' It complained about  missing the App_Data folder first.... ok I added that in and tried the install again now it's saying Error creating Role: The provider did not return a ProviderManifestToken string. and I'm stuck on that. I have read through most of the posts above and noticed that someone else had the same problem, but you said that you hadn't come accross that problem before, well I guess I'm the second one now. Can you give me any pointers.... Thanks in advance.

  • info@kingwilder.com
    Posted By: King Wilder
    On: 12/11/2013 4:07:45 PM

    @DataFlowJoe - when you say you've "installed both Nuget packages", which two are you referring to?  I assume one is the MvcInstaller.Mvc4, but what other one are you installing?  SecurityGuard?

    • App_Data folder - this is where your SQL scripts will live so MvcInstaller can install your application's database schema.  Aren't you using MvcInstaller to install your database on your server?
    • ProviderManifestToken - sorry, I still have not been able to reproduce this issue.  I use MvcInstaller with every application I build and I have not yet seen this error. Are you using an .edmx file for EntityFramework, or the DbContext?
    1. I assume the SQL Server instance is running, correct?
    2. Are you using a password for SQL Server authentication or Windows authentication?  Others have removed the "Integrated Security=true" and had it work.  Have you tried that?

    Let me know if any of this helped.

  • joe@data-flow.co.uk
    Posted By: DataFlowJoe
    On: 12/12/2013 8:16:41 PM

    Hi King Wilder, thank you for the quick response, I had set my initial connection string to my remote server, it seems to work best if you leave the default connection string pointing to the local file path just to get the tables created and then move the tables to the remote database when it's all working. I'm still fairly new to MVC, but I persevered and it's now working. Thank you so much for putting this  brilliant package together and making it available to the wider community.

    Is it possible to change the top level role 'SecurityGuard' to another name? If possible how is that done?

    Thanks

  • info@kingwilder.com
    Posted By: King Wilder
    On: 12/13/2013 10:57:21 AM

    @DataFlowJoe - your connection string should actually have the server where you are installing the application and database.  So this means that you FTP your web application to your production server and have your connection string that also points to your production database server.  Then everything should work.  That's how I built MvcInstaller.  I'm glad you got it done, but I'm sorry that it didn't work for you the way it was intended.

    The SecurityGuard role was created for anyone who is in charge of managing the Membership.  You can change it, but why?  This isn't a role that you would hand out to anyone.  I hope this makes sense.

  • johnv@dls.net
    Posted By: JohnVndnbrk
    On: 1/10/2014 10:17:21 AM

    Hello:

    Your link to Scott Hanselman's site has an extra "http//" at the begining of the target URL.  You can see this by hovering over the URL in IE - or clicking on the link, of course.

    Nice work!  Thanks for sharing!!

  • afb@gmail.com
    Posted By: afb
    On: 1/13/2015 8:32:08 AM
    Error    2    Assembly 'SecurityGuard, Version=1.0.55.580, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'    f:\BRITTO\Main Project\Project\packages\SecurityGuard.MVC5.1.0.5\lib\net40\SecurityGuard.dll
  • afb@gmail.com
    Posted By: afb
    On: 1/13/2015 8:32:08 AM
    Error    2    Assembly 'SecurityGuard, Version=1.0.55.580, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'  SecurityGuard.MVC5.1.0.5\lib\net40\SecurityGuard.dll
  • afb@gmail.com
    Posted By: afb
    On: 1/13/2015 8:32:08 AM
    Error    2    Assembly 'SecurityGuard, Version=1.0.55.580, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'  SecurityGuard.MVC5.1.0.5\lib\net40\SecurityGuard.dll
  • info@kingwilder.com
    Posted By: King Wilder
    On: 1/13/2015 8:59:02 AM

    @afb - this is due to a mismatched System.Web.Mvc assembly version between the assembly in your application, and the one that SecurityGuard uses. 

    It's a NuGet package.  You can just update that package.

    In nuget PowerShell type:

    update-package microsoft.aspnet.mvc

    Or you can right-click the project References and choose the "Manage Nuget Packages", then choose the "Installed Packages" tab on the left.  This will show you all your installed packages in your project.  Now scroll through the list until you see "Microsoft AspNet Mvc" and the button should say "Update".  Click that button and your project will be updated to the current version and it should work.

    I hope this helps.

 

User Name:
(Required)
Email:
(Required)