I am receiving the following error which I believe is a problem with my connection string on GoDaddy. I've copied from an example on Stack Overflow, but it doesn't seem to work. The first part of the stack trace that I'm getting is:
[MetadataException: Unable to load the specified metadata resource.]
System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String
assemblyName, String resourceName, ICollection`1 uriRegistry,
MetadataArtifactAssemblyResolver resolver) +2184231
I have a solution with only one project and, of course, the edmx is in that project.
Here is my connection string:
<add name="FCGUIDE_Entities"
connectionString="
metadata=res://*/CoreModel.csdl|res://*/CoreModel.ssdl|res://*/CoreModel.msl;
provider=System.Data.SqlClient;
provider connection string='
Data Source=susanbfarrar.db.9319451.hostedresource.com;
Initial Catalog=susanbfarrar;
integrated security=False;
multipleactiveresultsets=True;
App=EntityFramework;
User ID=*****;
Password=*****
Database=*****;'"
providerName="System.Data.EntityClient" />
Could you replace ' with " and try it again?
<add name="FCGUIDE_Entities"
connectionString="
metadata=res://*/CoreModel.csdl|res://*/CoreModel.ssdl|res://*/CoreModel.msl;
provider=System.Data.SqlClient;
provider connection string="
Data Source=susanbfarrar.db.9319451.hostedresource.com;
Initial Catalog=susanbfarrar;
integrated security=False;
multipleactiveresultsets=True;
App=EntityFramework;
User ID=*****;
Password=*****
Database=*****;""
providerName="System.Data.EntityClient" />
You already have Initial Catalog, so remove Database
Password=*****Database=*****;"
Like this -
Password=*****;"
Related
Can anyone help me with this? Ive been getting tons of errors. I know there's probably just a syntax error here somewhere, but I'm not sure if I'm doing it right.
this is the connection string that was given to me by smarterasp: "Data Source=SQL5006.Smarterasp.net;Initial Catalog=DB_9B7F44_capstone;User Id=DB_9B7F44_capstone_admin;Password=YOUR-PASSWORD;"
this was my connection string on my local machine:
<connectionStrings> <add name="d_CapstoneEntities1" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=WIN-C43BMU8UF5E\SQLEXPRESS;initial catalog=d_Capstone;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
and then I came up with this, but im still getting the error "Keyword not supported: 'data source'."
<add name="d_CapstoneEntities1" providerName="System.Data.EntityClient" connectionString="Data Source=SQL5006.Smarterasp.net;Initial Catalog=DB_9B7F44_capstone;User Id=DB_9B7F44_capstone_admin;Password=YOUR-PASSWORD;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework;"/></connectionStrings>
I used the EF database first btw.
I'm attempting to deploy my first website containing a database. The test local version has the following connection strings
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;IntegratedSecurity=SSPI;
AttachDBFilename=|DataDirectory|\aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ConnectionString"
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\AHData.mdf;IntegratedSecurity=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
I've setup the databases on the web hosting company server and they give me the following connections strings
Provider=sqloledb;Data Source=db479427514.db.1and1.com,1433;Initial Catalog=db479427514;User Id=dbo479427514;Password=****;
Provider=sqloledb;Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;User Id=dbo479427535;Password=****;
When I replace the local test connection strings with the new server ones using
<connectionStrings>
<add name="ApplicationServices"
connectionString="Provider=sqloledb;Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;User Id=dbo479427535;Password=**I've used real password!**;"
providerName="System.Data.SqlClient" />
<add name="ConnectionString"
connectionString="Provider=sqloledb;Data Source=db479427514.db.1and1.com,1433;Initial Catalog=db479427514;User Id=dbo479427514;Password=**I've used real password!**;"
providerName="System.Data.SqlClient" />
</connectionStrings>
I get the following error
Keyword not supported: 'provider'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Keyword not supported: 'provider'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[ArgumentException: Keyword not supported: 'provider'.]
[ArgumentException: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString]
Can anyone advise what is wrong here?
Try removing the 'provider' section of the connection string:
<add name="ApplicationServices" connectionString="Provider=sqloledb;Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535; User Id=dbo479427535;Password=**I've used real password!**;" providerName="System.Data.SqlClient" />
becomes
<add name="ApplicationServices" connectionString="Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;User Id=dbo479427535;Password=**I've used real password!**;" providerName="System.Data.SqlClient" />
Because the provider name is specified in it's own name-value pair (providerName=) I doubt it would be needed in the connection string. Give it a crack and report back.
Correct your Connecting sting to:
<connectionStrings>
<add name="ApplicationServices" connectionString="
Data Source=db479427535.db.1and1.com,1433;Initial Catalog=db479427535;
User Id=dbo479427535;Password=**I've used real password!**;"
providerName="System.Data.OleDb" />
<add name="ConnectionString" connectionString="
Data Source=db479427514.db.1and1.com,1433;Initial Catalog=db479427514;
User Id=dbo479427514;Password=**I've used real password!**;"
providerName="System.Data.OleDb" />
</connectionStrings>
This is because we dont have provider object in connection string, so remove that and specify the provider name under "providerName" section of connection string to: System.Data.OleDb
I am trying to pre-generate view metadata for my Entity Framework project and have run across a problem on the last step when using this resource:
http://msdn.microsoft.com/en-us/library/bb896240.aspx
Everything else is compiling great, but I'm getting an error when I run my application, and I suspect it's due to a problem with the final step, 're-adding mapping and model files as embedded resources for ASP.NET projects.'
I'm receiving 'Unable to load the specified metadata resource.' and my connection string is as follows:
<add name="myEntities"
connectionString="metadata=
.\DataStructure.csdl|
.\DataStructure.ssdl|
.\DataStructure.msl;provider=System.Data.SqlClient;provider
connection string="Data Source=x;Initial Catalog=x;Persist Security Info=True;User ID=x;Password=x;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
It is suggested in the document that my connection string file should include the following but haven't been able to get it right in any configuration:
Metadata=res://<assemblyFullName>/<resourceName>;
Metadata=res://*/<resourceName>;
Metadata=res://*;
Assuming my assembly name is DataStructure.EF, how should my string be constructed?
http://msdn.microsoft.com/en-us/library/cc716756.aspx
<connectionStrings>
<add name="AdventureWorksEntities"
connectionString="metadata=.\AdventureWorks.csdl|.\AdventureWorks.ssdl|.\AdventureWorks.msl;
provider=System.Data.SqlClient;provider connection string='Data Source=localhost;
Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60;
multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />
</connectionStrings>
I compiled a full guide for anybody else having problems and published it here: http://kewney.com/posts/software-development/pre-generating-views-to-improve-query-performance-in-aspnet-mvc-3-entity-framework
I have the following connection strings in development using visual studio web developer 2010 express:
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
<add name="DatabaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\BegASPNET\Cheeztest\App_Data\Database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
<add name="DatabaseEntities" connectionString="metadata=res://*/App_Code.CheeztestModel.csdl|res://*/App_Code.CheeztestModel.ssdl|res://*/App_Code.CheeztestModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
What do I need to change/delete/keep in order to connect to a GoDaddy account with the following parameters:
Host Name: someresource.com
Database Name: databasedb
Username: databasedb
Password: password
I am hosting on a GoDaddy account that only allows a single MS SQL database. In development I had two separate databases; one was ASPNETDB.MDF and the other was Database.MDF. Do I also need to have two separate databases in the hosted environment?
I forgot to mention that yes, GoDaddy does provide a configuration string. I have been trying for two days to make it work without success which is why I am posting here.
The string provided by GoDaddy is:
Data Source=somesource.com; Initial Catalog=databasedb;User ID=databsedb; Password=password;
Also, if necessary I can upgrade my GoDaddy account and get another database. Which I am willing to do if it will make my life easier.
UPDATE:
I changed connection strings to this:
<add name="ApplicationServices" connectionString="data source=leqaspnetdb.db.8311806.hostedresource.com;Initial Catalog=leqaspnetdb;User ID=leqaspnetdb; Password=Dan13206" providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=leqaspnetdb.db.8311806.hostedresource.com;Initial Catalog=leqaspnetdb;User ID=leqaspnetdb; Password=Dan13206" providerName="System.Data.SqlClient" />
<add name="DatabaseConnectionString" connectionString="Data Source=leqaspnetdb.db.8311806.hostedresource.com;Initial Catalog=leqaspnetdb;User ID=leqaspnetdb; Password=Dan13206" providerName="System.Data.SqlClient" />
<add name="DatabaseEntities" connectionString="metadata=res://*/App_Code.CheeztestModel.csdl|res://*/App_Code.CheeztestModel.ssdl|res:
//*/App_Code.CheeztestModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=leqaspnetdb.db.8311806.hostedresource.com;
Initial Catalog=leqaspnetdb;User ID=leqaspnetdb;Password=Dan13206;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
And I get this error:
Illegal characters in path.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Illegal characters in path.
You can certainly use one database in your hosted environment as long as there are no schema conflicts.
You can have multiple connectionStrings in web.config pointing to the same database.
Here is an example connection string for discountasp.net hosting (sorry have nothing with goDaddy).
<add name="TestDiscountAspNet"
connectionString="Data Source=xxx.discountasp.net;Initial Catalog=SQL2008R2_837232_yyy;
Persist Security Info=True;MultipleActiveResultSets=True;User ID=myUserName;Password=myPassword"
providerName="System.Data.SqlClient"/>
If you still have any problem, please describe what the problem is.
Below is documentation on Godaddy about connecting to its database:
(http://support.godaddy.com/help/article/256/connecting-to-a-microsoft-sql-server-database-using-aspado?locale=en&ci=4606)
This example describes using ASP/ADO to connect to a Microsoft SQL Server Database.
Replace the db_ fields with the information for your database from the Control Panel in your hosting account. For more information, see Locating Your MS SQL Database Connection Strings for more information.
<%
'Sample Database Connection Syntax for ASP and SQL Server.
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server
db_server = "whsql01.mesa1.secureserver.net"
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"
connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename
Set oRS = oConn.Execute(qry)
Do until oRs.EOF
Response.Write ucase(fieldname) & ": " & oRs.Fields(fieldname)
oRS.MoveNext
Loop
oRs.Close
Set oRs = nothing
Set oConn = nothing
%>
Parser Error Message: An attempt to
attach an auto-named database for file
D:\Projects\Damnation\Damnation.Website\Damnation.Website.Tracker\BugNET_WAP\App_Data\aspnetdb.mdf
failed. A database with the same name
exists, or specified file cannot be
opened, or it is located on UNC share.
Why could this be happening? My connection string doesn't use |DataDirectory|, it is:
<connectionStrings>
<add name="BugNET" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dnmain;Integrated Security=True;"/>
</connectionStrings>
I get this error when I try to load default.aspx, after installing BugNET.
Apparently, and certainly for some obscure reason. There is a mistery connection string coming from... nowhere.
Problem solved adding a <clear/> tag.
<connectionStrings>
<clear/>
<add name="BugNET" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=dnmain;Integrated Security=True;"/>
</connectionStrings>
file
D:\Projects\Damnation\Damnation.Website\Damnation.Website.Tracker\BugNET_WAP\App_Data**aspnetdb.mdf**
failed.
This is the ASP.NET standard membership system here - not your "regular" database. There must be a second connection string somewhere that references this aspnetdb.mdf and tries to attach it from a file.
Search your solution for this file name - it must be somewhere!