SQL Server Express 2008 Connection String does not appear in web.config - sql-server-2008

I need some help here.
I am using VS 2010 Pro. When I create an empty ASP.NET Website and add users to it either through:
Asp.Net Configuration Wizard or
through a Register.aspx page with createuser wizard
everthing works fine. I get an ASPNETDB.MDF in my App_Data folder. The membership and roles, login and logout all work as expected.
The problem is that the web.config file does not show the connection string to SQL Server Express database file. Also the membership element etc are also missing.
However, if I create an ASP.NET Website (not an empty ASP.NET website), then web.config file carries all the information.
I have tried this on
Windows 7 Ultimate with VS 2010 Pro and IIS 7.5
Windows XP Professional with VS 2010 Pro with VS builtin development server
Same results.
Any ideas?

Thanks for the help
I have found the answer.
The connection string for the ASPNETDB.MDF does not appear in web.config.
The application uses a machine wide connection string defined in the machine.config file.
For more details check my answer here.

Related

how to publish vb.net project with MySQL database on another computer

I have an application using vb.net with MYSQL database in visual studio 2015 now i need to create a installation package to deploy the application to client computer.
I don't have any idea how to do this please anyone give tips how i can do this, im new with MYSQL.
It depends, what technology are you using? If you are using entity framework you should have a .config file in your project, usually it's called app.Config, you can specify your <connectionStrings> there. Else if you use SqlConnection, you'll have to change that string.

BC30002: Type 'MySqlConnection' is not defined - once code is on Web Server

I am creating a web site in Visual Studio 2013 Web Express using ASP and VB. The code works 100% fine in localhost, but once I FTP transfer my files over to my school's server, it no longer works. The web server comes up with an error message (Title) and says it stopped at here:
Imports System.Data
Imports MySql.Data.MySqlClient
Partial Class Home
Inherits System.Web.UI.Page
Private conn As New MySqlConnection
I've read many people having problems with this before but they all only stated the same answers that I've tried (will list below)
First off, just want to remind everyone that this does work on my local computer
I do have a working reference on my system to MySql.Data.dll
I have tried several different versions of this
I have tried not installing the Connector/Net for MySQL and ONLY referencing a MySql.Data.dll from within my Bin Folder. This works, confirming that they should not have to install the Connector/Net on their server.
It is in my Bin folder, which is located at the same level as my web pages
When I have uploaded my web site to the FTP server with MySQL.Data.dll targeting .Net 4.0, it did display an error, saying this was too high of a target since my project is in .Net 3.5
As a note, the .Net files I am getting for MySQL.Data.dll target .Net 2.0, since that's the next lowest from 4.0
Thanks to reading, any input is appreciated. I'll supply as much information as I can if there's any questions.
You don't put the image files under the Views folder. The URL you specify in the view is relative to the application itself, so you images folder should be under the project folder.

Publishing ASP.NET MVC 4 Web Application with Mysql Database

I have successfully created a ASP.NET MVC 4 Web application and now I want to deploy it on a test environment. The target server is not an Azure server, but it is a Windows Server 2008 R2 Server with IIS installed in it.
Now I have published my solution using Visual Studio 2013 Professional, everything works fine excepts the Database. It's a Mysql Database that works perfectly with Entity Framework 5 (I have added the Mysql provider, mysql.data.entity.dll , mysql.data.dll on my web project and all the configuration to make it run locally). Once I publish the project, it is deployed on IIS but it doesn't retrieve data from my Mysql Database. I want to notice also that in the Publish wizard, although I specified the connection string, it says that
there is no Database detected
It should display the name of my context instead of that. Would you please help me know why the publishing wizard doesn't recognize my Mysql Database? thank you for your help !
I was able to use Asp.net MVC with MySql using Entity Framework code first, like the one explained here http://www.asp.net/identity/overview/getting-started/aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider ... Here a couple the things I notice:
The generated migration contains the schema dbo. that won't work on MySql so I went to the migration file and remove all schema references. (there are better solutions, like configuration/setup wise)
The unique key length problem, such as UserName (defined in the asp.net Identity) has a maximum length of 256 and that is over the limitations of mysql unique field, so I changed the length to 128. that solved this error
Specified key was too long; max key length is 767 bytes
I did have some troubles using the publishing wizard, since didn't show me any of my MySql Drivers to test my connection to my db, so I just change the Connection string in the config file and apply my migration changes to the new/testing DB from the Package Manager Console > Update-Database (this could be your temporary solution until you find a automatized solution)

Running ASP.NET app with VS2012 debugger uses LocalDB despite connection string in web.config

I want to use SQL 2008 R2 on the server where I run VS 2012, so I created the "membership" database (using Aspnet_regsql tool) and configured it to work with IIS7). Then I created ASP.NET Application and modified the web.config so that connection string points to this database.
Running this app with VS 2012 debugger results with my app creating the LocalDB ASPNETDB.MDF instance in app_data folder. VS ASP.NET Configuration tool when invoked from VS Tools menu shows the LocalDB based data and the running application access this database instead of SQL Server 2008 R2 server - which runs on the same server.
I believe that this is some side-effect of the VS generated web.config file, but despite looking hard, I found nothing suspicious.
Note: this same scenario works just fine with Visual Studio 2010 if I am using it's own generated web.config file.
I would hate to dismiss VS 2012 for this as I am pretty sure that I did something wrong.
I had the same problem as this and needed to change more than just the connection string. I was targeting .NET 4.0 framework not 4.5, not sure how much difference this makes. I had a look on MSDN http://msdn.microsoft.com/en-us/library/6e9y4s5t(v=vs.100).aspx
You need to change not just the connection string but also the membership defaultProvider so that it is a SqlProvider

How do I connect to MySQL 5.1 in Visual Studio 2010?

Does any one know how to connect to MySQL 5.1 with Visual Studio 2010?
I have already tried the MySQL Connector/ODBC route and it got me really nasty results. The table rows were all listed as a view in the views section and nothing at all was listed in the tables or procedures folder.
To get the Entity Frame working with VS2010, I had to do the following:
This only worked with Mysql .net Connector v6.3.1 (alpha). Previous versions ignored VS 2010 (click Development Releases)
I had to rename my Framework\v1.1.4322\CONFIG folder. Otherwise the install will fail. Rename it back when finished
(I've blogged about this here)
Update
6.3.2 is in beta and I can confirm this works. (I didn't need to rename the framework folder)
this seems to solve the issue
UPDATED LINK TO LATEST RELEASE THANKS #Christian Payne
Update: looks like there is already a non-beta!!!!
http://www.mysql.com/downloads/connector/net/
As someone else suggests..
http://dev.mysql.com/downloads/mirror.php?id=382641
..fixes the problem.
I had v6.2.3 installed after I had vs2010 installed and the MySQL driver was not shown in the list of the Database Connect dialog. I wrongly assumed I should use the .NET ODBC drivers instead and it caused all sorts of problems. Although I could easily connect to the DB using codebehind, the server explorer wouldn't connect to the DB.
Luckily after uninstalling 6.2.3 and installing 6.3.0 (from the link above) the MySQL driver was added to VS2010, and I was able to connect to the database and see it in my server explorer.
http://bugs.mysql.com/bug.php?id=45122
I was able to get this to work by doing the following:
My Environment:
Development Box -- Win7 64bit,
VS2010 Pro
Deployment Box -- Win2k8 svr with IIS7
running ASP.NET .Net 2.0/3.0/3.5 sp which is
hosted at DiscountAsp.Net (Note:
DiscountAsp.Net does not provide a
MySQL DB when running on a Win2k8
svr, I'm using a MySQL DB that I connect
to elsewhere on the InterWebs)
Steps I took:
Installed MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
Ref'd the .Net 2.0 version of the MySQL assembly in my ASP.NET MVC2 Web project set to target .Net 3.5 (the path for the MySQL assemblies I used was C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0)
I ref'd all 3 of the MySQL assemblies (MySql.Data.dll, MySql.Data.Entity.dll & MySql.Web.dll)
I marked each of those assemblies as "Copy Local=True" in my project (a.k.a bin deployment)
Added a MySQL DB connection string to my Project (using the MySQL provider)
Added an ADO.NET Entity Data Model to my project in VS2010 using the connections string
VS2010 took about 30 secs to chew thru my MySQL DB schema but then provided me with a beautiful GUI interface to tweak my MVC Models
Used the DB Entities in my MVC controllers
Deployed the app to my hosted server at DiscountAsp.Net
It works like a charm :)
Erm... through code? Or do you mean the server explorer add-in? Have you tried the latest (albeit GPL-ed) connector version for .NET from Mysql themselves? Again, it's GPL-ed so be aware of the consequences of using that for your own software.
Microsoft Visual Studio 2010 Beta 2 is busted for DDEX providers. They are auto promoting a VS 2008 assembly from 9.0 to 10.0 and it fails. The failure has to do with the fact that a .NET 2 assembly cannot load a .NET 4 assembly.
This worked in beta 1, so it is something they broke.
I even went back and tried the reference DDEX provider from the SDK. It won't load in VS 2010 beta 2 either. That tells me they have something that needs to be fixed.
When is the next beta?