One of the issues of deploying with Web Matrix (e.g.) is dealing with the "complexities" of setting up the StarterSite database with roles and memberships and then getting that deployed to Winhost. Excuse me if at this point, there is someone who has been able deploy the StarterSite database and not faced "issues". I am not really pointing these problems out for someone who has never tried this themselves. Oh, the documentation is straight-forward. The problems with deployment are always the same and reproducible. In fact, I submit, many of the forum deployment threads are about what follows. After deployment, the first problem is that you are going to see a directory of your web site when you run your website. You need to go back to WebMatix/Site/Settings and a add a "Default.cshtml" file to the default files list. (You can do this with IIS7, but who really needs it). Now, redeploy. The next issue is when you run your site, you will get an error that says you do not have a "LocalSqlServer". No problem, just add a connection string that says "remove name= LocalSqlServer". (there are ways that you can do this using IIS7). Just add the connection string and redeploy. Well, now your site when it runs will tell you that that roles have not been enabled. Look at the error a little closer and you will see something about the machine.config file (very confusing). jamesbond has worked on this "same subject" and has found an "enable simpleSecurity" string for web.config. See his thread on SQL CE 4.0" (or something like that) After adding the simpleSecurity=true, and after redeployment,now we see another error dealing with the machine.config file and it wants "LocalSqlServer". I have seen the discussion on using the ASP.NET Security Management website, (not available from WebHost's Control Panel) but I think that is a red hearing. We are talking about WebMatrix deployment and we should be able to do this. Anyone know where to go from here?
OK, it is obvious that I am a newbie. I will just add some quick answers so that this can be "closed" at least by me. You can not export a \SQLEXPRESS database with membership roles and expect that it is going to work. "When using the membership API, you have to setup a data store that will be used by your membership provider. ... However, when using any other edition of SQL Server, you have to create this storage manually," ASP.net 4 Pro C# 2010, pg 883. SQL Express databases are nice but they are not meant for production environments. The bottom line for a database you want to export to host; run aspnet_regsql.exe to set up the security. Change your web.config <system.web> <authentication mode= "Forms" /> <membership defaultProvider="MYMembershipProvider"> providers> <add name="MYMembershipProvider", connectionStringName= ...and so on... </providers> </membership> </system.web>
No, this did not work. The asp.net forums all "concur" that running aspnet_regsql is the answer. I was able to run aspnet_regsql with it pointed at the Winhost database. I think it worked. At least now I am not getting an error dealing with the data provider not being installed. Still looking for an answer and not finding it.
Finally, I went through all of the VS2010 project templates (excluding Web Pages) and was unable to get any of them to run completely with security/membership/roles/etc. I could get all of the websites to appear, but as soon as I selected "Log in", you would get an exception and the "links" would fail with not being able to find the logoin page (it is the correct path!). It did this for all templates including WebMatrix. Even the asp.net forums were confused by the failure. This is with Web Deploy and having the localhost able to connect to the web database and be able to create new users, log in, register, etc. Executing WAT from VS2010 would verify the users and security memberships. Yet, after a successful web deploy, the web site will throw an exception because it can not find a form that is on the web site. No progress or help is not a solution. I am going to try switching hosts. Fortunately, I am a member of MSDN which allows me to add my honest review and final comparison to host site reviews. I am just trying to take a standard template and get that website published -- all of the procedures from all of the hosting providers are the same -- they are using Web Deploy. Change the connection strings, run aspnet_reqsql on the web site database and you can connect your localhost website to the online database (inside VS2010) and everything runs fine. Web Deploy, well that can be a problem, with no resolution from anyone at this host.
This has been a trip. I am still trying to categorize the episode. I was able to go to another host and repeat the publishing procedures and guess what -- well there is a cliff hanger here -- I was getting the same error. Oh, I was still looking at Winhost. The trick is ... take a VS2010 template for either MVC2 or ASP.NET 4 web project. Use aspnet_regsql to configure your website database for security/membership/roles. Take your project web config and point it at the website database. Publish the database. Migrate to "About" no problem. Try to Log in.... I have tried without success here at Winhost for almost a month to solve this problem. ASP.NET forums, could not come up with an answer except for one. Something is wrong with the installation. I did not have a choice. I switched to another host... One click, (well once all of the dialog boxes are filled in) produces a fully functioning website including security/membership/roles at a competitor and does not here. The Web Deploy instructions are exactly the same for both hosts. I am just happy I have something that works now and is not such a mystery, right from the "get-go". Sorry, if I missed something, then please I will stand corrected.
If you want to use Web Matrix to deploy a Razor application try these steps. Open web matrix and choose Site from Template. Choose StarterSite. If you check on the Files section you will see that the web.config file is not yet created. It will not be created until you start publishing it to the server. On the Site button you will see a link that reads "ASP.NET Pages Administration". Click on that an input the passwords. You should get a message that instructs you to find the file _Password.config under the folder App_Data/Admin. Rename it by removing the underscore "_" from the file name which will make it to Password.config. Go back to "ASP.NET Pages Administration" and type in your password. This will log you into a page where you can download different Assemblies/Binaries to your application. On this page, look for the drop down Source and choose "Default (ALL)". In the search text box type simplemembersmvc. It should generate a list. Install SimplyMembers.Mvc3 1.2. Once this is installed on your application run the Web Deploy process to publish it to the web server. At this point you will see the web.config created and a Bin folder with all kinds of different .dll files along with the DLL file (simpleMembershipMVC) uploaded to the web server. You're not done yet. When you have everything uploaded to the web server, now you will need to connect via FTP and add this line to the web.config file. It will be between the XML element "Configuration" <configuration> <system.webServer></system.webServer> <connectionStrings> <remove name="LocalSqlServer" /> <add connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" name="LocalSqlServer" /> </connectionStrings> </configuration> The problem with testing MVC/Razor with Visual Studio or Web Deploy is the run or view feature it has to pull up your site. When you use this it uses its own Engine and for what ever reasons, it automatically adds all the required assemblies and binaries when you use this tool. Which makes it confusing because you get the impression that it works and nothing else is needed to get it to work. In all honesty, there are more steps needed to actually get it to run on a Full IIS server. You can replicate the error you are having on the web server by simply setting up your local machine with IIS and uploading the site you created to that IIS root. Don't use Web Matrix or Visual Studio to view your site. If you do this, you should start seeing the same errors that the web server is displaying.
Maybe, the issue has gotten lost because I have actually posted under several threads. Here is what I am saying -- forget WebMatrix(just for simplicity)-- take any other template with ASP.NET or ASP.NET/MVC in VS2010. Setup a database on Winhost (by creating it), establish roles/membership/security by using aspnet_regsql. Change your web.config file to connect to the Winhost database. Run WAT and verify that you are connected and have your database configured. Run your web on the localhost. Now, publish it (WebDeploy). Try to log on. I get an error at Winhost. Using this same procedure at your competitor works. The other issue is that I had to go to another host. Whatever I was doing wrong at Winhost is no longer a concern. Mark this as answered.
And just to make the point real clear, publishing WebMatrix is exactly the same for any other template that uses Web Deploy -- at an alternate hosting site. WebDeploy works for all templates without any other changes other than to the database connection string in the web.config file. They do not need a forum for people to get help trying to deploy. Sorta sells it's self.