I create a small app with ASP.NET MVC 2.0, I used the default membership to manage my user datas, and I had to create a new database to save it, and I made sure the project can build successfully, and then I deployed it to the host offered by Cytanium,
but it alert the exception "Keyword not supported: 'data source'" all the time, I had tried so many ways to change the connection string in web.config, but it didn't work at all, and the current connection stirng is below:
There is a default connection string with the name "localSqlServer", which is used when using for example Membership. If you add a clear element before adding your connectionstrings, it´s being removed.
Mikael Söderström
http://weblogs.asp.net/mikaelsoderstrom
http://www.twitter.com/vimpyboy
Server Error in '/' Application.
--------------------------------------------------------------------------------
Keyword not supported: 'data source'.
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: 'data source'.
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.
Stack Trace:
[ArgumentException: Keyword not supported: 'data source'.]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5055124
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +8080102
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +42
HobbyNotes.Models.HobbyNotesContainer..ctor() in G:\My Workstation\HobbyNotes\HobbyNotes\HobbyNotes\Models\HobbyNotes.Designer.cs:40
HobbyNotes.Controllers.HobbyController..ctor() in G:\My Workstation\HobbyNotes\HobbyNotes\HobbyNotes\Controllers\HobbyController.cs:16
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +80
[InvalidOperationException: An error occurred when trying to create a controller of type 'HobbyNotes.Controllers.HobbyController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +189
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +66
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +124
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +50
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8837208
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
First of all, my app worked correctlly, a weird thing of it, because I just use the default connectionString, and I just change the method to make a connection to server in xxxxRepository.cs:
I used early:
privateHobbyNotesContainer db = newHobbyNotesContainer()
Instead of it, I use
privateHobbyNotesContainer db = newHobbyNotesContainer("metadata=res://*;provider=System.Data.SqlClient;provider connection string=\"Data Source=;Initial Catalog=;User ID=;Password=;MultipleActiveResultSets=True;\"");
Another weird thing is that only when I use the connectionString to get the db, it will work, but if I just use "ConfigurationManager.ConnectionString["xxxxContainer"].toString()", it will throw an exception just I said before,
So I think that must be something wrong between the hosting server and the project which I deployed, but I just find a way how to make it work, just it.
I hope someone will knows something about it, I will thanks as always.
guilin_gavin
0 Points
6 Posts
The issue about "Keyword not supported: 'data source'"
Jul 15, 2010 09:40 AM|LINK
First of all, I list all my configrations below:
Window 7 Ultimate
Vitual Studio 2010
ASP.NET MVC 2.0
Hosting: Cytanium
I create a small app with ASP.NET MVC 2.0, I used the default membership to manage my user datas, and I had to create a new database to save it, and I made sure the project can build successfully, and then I deployed it to the host offered by Cytanium, but it alert the exception "Keyword not supported: 'data source'" all the time, I had tried so many ways to change the connection string in web.config, but it didn't work at all, and the current connection stirng is below:
=====================================>
<connectionStrings>
<add name="ApplicationServices" connectionString="Server=webmatrix01.cytanium.com;Initial Catalog=ASPNETDB;User Id=gavin;Password=198396Yang" providerName="System.Data.SqlClient"/>
<add name="HobbyNotesContainer" connectionString="metadata=res://*/Models.HobbyNotes.csdl|res://*/Models.HobbyNotes.ssdl|res://*/Models.HobbyNotes.msl;provider=System.Data.SqlClient;provider connection string="Server=webmatrix01.cytanium.com;Initial Catalog=HobbyNotes;User ID=gavin;Password=198396Yang;"" providerName="System.Data.EntityClient"/>
</connectionStrings>
=====================================>
I have no idea why it show up the exception about the keyword "data source", I even didn't use it in my connection string ....
Is that a problem about the ASP.NET MVC 2.0, or about the hosting server didn't support EF4?
Thanks very much, if you have some good idead, please let me know.
webmatrix
Vimpyboy
Contributor
3212 Points
651 Posts
MVP
Re: The issue about "Keyword not supported: 'data source'"
Jul 15, 2010 11:11 AM|LINK
Add this before the first <add ... /> :
There is a default connection string with the name "localSqlServer", which is used when using for example Membership. If you add a clear element before adding your connectionstrings, it´s being removed.
http://weblogs.asp.net/mikaelsoderstrom
http://www.twitter.com/vimpyboy
guilin_gavin
0 Points
6 Posts
Re: The issue about "Keyword not supported: 'data source'"
Jul 15, 2010 11:02 PM|LINK
Unfortunately, the issue is the same.
You could see the issue through the url: guilinyang.webmatrix01.cytanium.com
=======================================
<connectionStrings> <clear /> <add name="ApplicationServices" connectionString="Server=webmatrix01.cytanium.com;Initial Catalog=ASPNETDB;User Id=gavin;Password=198396Yang" providerName="System.Data.SqlClient"/> <add name="HobbyNotesContainer" connectionString="metadata=res://*/Models.HobbyNotes.csdl|res://*/Models.HobbyNotes.ssdl|res://*/Models.HobbyNotes.msl;provider=System.Data.SqlClient;provider connection string="Server=webmatrix01.cytanium.com;Initial Catalog=HobbyNotes;User ID=gavin;Password=198396Yang;"" providerName="System.Data.EntityClient"/> </connectionStrings>=======================================
and the error message is below:
=========================================
WebMatrix
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: The issue about "Keyword not supported: 'data source'"
Jul 16, 2010 03:13 AM|LINK
http://stackoverflow.com/questions/1113361/ado-net-entity-connection-string-for-multiple-projects
http://stackoverflow.com/questions/693499/asp-net-system-data-entityclient-connection-string-help
Don't forget to change the password,
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
guilin_gavin
0 Points
6 Posts
Re: The issue about "Keyword not supported: 'data source'"
Jul 16, 2010 04:39 AM|LINK
I've tried all these ways, but it still doesn't work at all ...
guilin_gavin
0 Points
6 Posts
Re: The issue about "Keyword not supported: 'data source'"
Jul 16, 2010 06:20 AM|LINK
First of all, my app worked correctlly, a weird thing of it, because I just use the default connectionString, and I just change the method to make a connection to server in xxxxRepository.cs:
I used early: