This is getting on my nerves a little bit now and I'm trying to find a solution to a problem I'm getting deploying my site. My host will only let me use FTP load and there's plenty of information on using Web Deploy, but the FTP method is frustrating me. Everything works except my user login database, it just keeps triggering an error page.
It's a web forms web application. Essentially what I've done to prepare the site before uploading is I've made sure the settings for IIS on my host server are set to v4.0 (I am using ASP.NET 4.0 within Visual Web Developer 2010) and that the application pool is set to integrated. This means it's compatible to run the site, in fact, it is running it. So I don't think there's a problem there.
Because my user-database is in .MDF file in my App_Data, what I've done to get it onto my server is to use the 'Publish to Provider' feature in Visual Studio and have used it as a query in SQL Management Studio to get the user database up and running and it is - I've tested it in SQL Management Studio and all of my data transferred with it (my test user accounts).
I also went to my web.config and updated my connection string. Yet I seem to still trigger the error, so to test it, I went to make a new user account on my localhost to see where it would end up, the database on my computer or the database on the server and it ended up on the database on my computer. As I am using the login controls built into the framework I don't have any specific database references in any of my pages. I've also tried changing the Connections in Database explorer too.
So I'm not sure exactly what's referencing the database on my PC.
Here is my web.config file (with private information removed):
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<system.web>
<roleManager enabled="true" />
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms" />
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="PlayerDbContext" connectionString="Data Source=[source];Initial Catalog=[database];Persist Security Info=True;User ID=[id];Password=[password]"
providerName="System.Data.SqlClient" />
</connectionStrings>
<location path="default.aspx">
<system.web>
<httpRuntime requestValidationMode="2.0" />
</system.web>
</location>
<location path="Authenticate/AddCharacter.aspx">
<system.web>
<httpRuntime requestValidationMode="2.0" />
</system.web>
</location>
</configuration>
I am obviously missing something, but at the moment, it's a mystery to me. My database should in theory be working.
Maybe it'll come to me when I've slept on it.