Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

ASP.NET MVC3 Web Application

Hello,
I am new to App Harbor. I created a new project from the ASP .NET MVC 3 Web Application template. I created a database and specified the connection string name that I found in the web.config: ApplicationServices. Alas, that is not working. Should I specify the database connection string manually? Or should I start with a different project template?
Thanks,
Jacob

  1. Please refer to the "Connectionstring Name" section of this article, and let us know if you have any questions.

  2. friism closed this discussion on 13 Jul, 2011 02:33 AM.

  3. jfoshee re-opened this discussion on 13 Jul, 2011 03:40 AM

  4. I did look at that, but I'm not sure it is enough information for me. That is in part because I am new to ASP .NET MVC.
    The connection string in the web.config which was created by the project template looks like this:

    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
    

    I specified "ApplicationServices" as the connection string name when I created a SQL Server database.

    I removed the EntityFramework reference from the project, and it still built and ran locally, so that doesn't seem to be the issue either.

    If this is not enough information I'll continue to investigate. I will compare my project to some of the working projects you have on GitHub. I do want to reiterate, however, that this is a default MVC 3 template project... Seems like this should work out of the box for you guys.

    Thanks,
    Jacob

  5. Surely you have to change the name of your connection string from name="ApplicationServices" to name="YourDbName". If you also want to use MembershipProvider you have to configure your db using aspnet_regsql tool.

  6. Thanks, Fabrizio! aspnet_regsql did the trick! I can now log on to the demo site. I did not have to change the name of the connection string.

    I've used Rails and Heroku in the past, and the database is built automatically. I will have to learn how that is handled here...

    For other readers, here's what I did:

    1. See http://msdn.microsoft.com/en-us/library/ms229862(v=VS.100).aspx for a description of the aspnet_regsql tool. It initializes your database with tables necessary for the canned services (e.g. the MembershipService which facilitates logging on)
    2. Open the database page on AppHarbor to show your new db
    3. Run aspnet_regsql with no arguments for the wizard. On my box it was at:
      "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe"
    4. Select Configure ..., click Next.
    5. Copy/Paste info from the AppHarbor db page to the wizard.
    • Host -> Server
    • Sql Server Authentication (User name and Password)
    • Paste the db name (probably same as user name) in the database field

    Click Next, then Finish. I think that's it.
    Jacob

  7. Hi Jacob,

    Thanks for getting back with the solution, I'm sure it'll help other users. Also thanks to Fabrizio for helping out here :-)

    Best,
    Rune

  8. rune closed this discussion on 13 Jul, 2011 04:06 PM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac