webform采用的是普通开发+sqlite+ADO.Net 实体模型(EF)上传到网站后出现如下错误,请问如何解决
问题描述
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 File: e:\webroot\kendeji\web\Index.aspx Line: 9
Line 7:
Line 8: <%
Line 9: ProConfigInfoData pcid = new ProConfigInfoData();
Line 10: ConfigInfoModel cim = pcid.QueryConfig();
Line 11: if (cim == null)
Stack Trace:
[ArgumentException: Keyword not supported: 'data source'.]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5110868
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +118
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +42
System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +16
Dragon.F3._5.WebForm.DB.DragonWFSqliteEntities..ctor(String connectionString) +42
Dragon.F3._5.WebForm.backstage.ConfigInfo.ProConfigInfoData..ctor() +50
ASP.index_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in e:\webroot\kendeji\web\Index.aspx:9
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060
看堆栈信息好像是链接字符串出了问题,ado.net实体在本地创建的时候指定了绝对路径,上传到服务器后已经修改了路径,单还是会报错。出错的页面Index.aspx,我在这个页面new 了一个类,那个类在new 了一个实体模型。
问题描述
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 File: e:\webroot\kendeji\web\Index.aspx Line: 9
Line 7:
Line 8: <%
Line 9: ProConfigInfoData pcid = new ProConfigInfoData();
Line 10: ConfigInfoModel cim = pcid.QueryConfig();
Line 11: if (cim == null)
Stack Trace:
[ArgumentException: Keyword not supported: 'data source'.]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5110868
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +118
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +42
System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +16
Dragon.F3._5.WebForm.DB.DragonWFSqliteEntities..ctor(String connectionString) +42
Dragon.F3._5.WebForm.backstage.ConfigInfo.ProConfigInfoData..ctor() +50
ASP.index_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in e:\webroot\kendeji\web\Index.aspx:9
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060
看堆栈信息好像是链接字符串出了问题,ado.net实体在本地创建的时候指定了绝对路径,上传到服务器后已经修改了路径,单还是会报错。出错的页面Index.aspx,我在这个页面new 了一个类,那个类在new 了一个实体模型。
解决方案 »
- .net c/s 程序,mysql数据库,性能及并发问题的疑问?
- 诚心求一个NavigateUrl的vb后台编写
- 请问读bolb字段是中文乱码的解决方法
- GridView 绑定字段内容为空是格式化显示问题
- 隐藏错做
- vb.net访问 asp.net页面控件的问题
- 紧急紧急!关于服务器文本框控件的OnTextChanged事件
- _______新手问题,谢谢
- 运行ASP.NET的AJAX技术时总出错怎么办
- 大家对把现有的asp程序转换到asp.net程序有什么看法,我觉得简直太麻烦了,许多怪现象让人要发疯。下面简单举几个例子
- string类型强制转换为Decimal类型
- net3.5 Gridview 数据导出到Excel
--------------------------------------------------------------------------------Unable to find the requested .Net Framework Data Provider. It may not be installed.
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: Unable to find the requested .Net Framework Data Provider. It may not be installed.Source Error:
Line 7:
Line 8: <%
Line 9: ProConfigInfoData pcid = new ProConfigInfoData();
Line 10: ConfigInfoModel cim = pcid.QueryConfig();
Line 11: if (cim == null)
Source File: e:\webroot\kendeji\web\Index.aspx Line: 9 Stack Trace:
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1420519
System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +35[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]
System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +62
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +263
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +42
System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +16
Dragon.F3._5.WebForm.DB.DragonWFSqliteEntities..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\DB\DragonWFSqlite.Designer.cs:26
Dragon.F3._5.WebForm.backstage.ConfigInfo.ProConfigInfoData..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\backstage\ConfigInfo\ProConfigInfoData.cs:14
ASP.index_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in e:\webroot\kendeji\web\Index.aspx:9
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060
有没有朋友用sqlite+EF开发过?有碰到我这样的问题吗?
源错误在服务器上:Source File: e:\webroot\kendeji\web\Index.aspx Line: 9
而堆栈的错误在
Dragon.F3._5.WebForm.DB.DragonWFSqliteEntities..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\DB\DragonWFSqlite.Designer.cs:26
Dragon.F3._5.WebForm.backstage.ConfigInfo.ProConfigInfoData..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\backstage\ConfigInfo\ProConfigInfoData.cs:14
类怎么会跑绝对路径去获取数据呢?
源错误在服务器上:Source File: e:\webroot\kendeji\web\Index.aspx Line: 9
而堆栈的错误在
Dragon.F3._5.WebForm.DB.DragonWFSqliteEntities..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\DB\DragonWFSqlite.Designer.cs:26
Dragon.F3._5.WebForm.backstage.ConfigInfo.ProConfigInfoData..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\backstage\ConfigInfo\ProConfigInfoData.cs:14我都是编译后再上传的?怎么类里面会有我本地的路径?这个是我在本地写得一个类
Dragon.F3._5.WebForm.backstage.ConfigInfo.ProConfigInfoData..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\backstage\ConfigInfo\ProConfigInfoData.cs:14
这个实体数据是在本地创建的创建的时候让选择路径,选了以后通过查看属性,路径是本地的,但是我通过在web.config中配置的是服务器的,为什么错误出现后会看到本地的地址?
Dragon.F3._5.WebForm.DB.DragonWFSqliteEntities..ctor() in D:\项目\MVC项目\Dragon.F3.5.WebForm\Dragon.F3.5.WebForm\DB\DragonWFSqlite.Designer.cs:26
string serverName = serverAddr;
string databaseName = "TTTTT"; SqlConnectionStringBuilder sqlBuilder =
new SqlConnectionStringBuilder(); sqlBuilder.DataSource = serverName;
sqlBuilder.InitialCatalog = databaseName;
sqlBuilder.IntegratedSecurity = false;
sqlBuilder.UserID = userId;
sqlBuilder.Password = password;
sqlBuilder.MultipleActiveResultSets = true; string providerString = sqlBuilder.ToString(); EntityConnectionStringBuilder entityBuilder =
new EntityConnectionStringBuilder(); //Set the provider name.
entityBuilder.Provider = providerName; // Set the provider-specific connection string. entityBuilder.ProviderConnectionString = providerString; entityBuilder.Provider = providerName; // Set the Metadata location.
entityBuilder.Metadata = @"res://*/CRM.ZHaoCRM.csdl|
res://*/CRM.ZHaoCRM.ssdl|
res://*/CRM.ZHaoCRM.msl";
//或从.config文件中copy
//@"res://*/NBModel.csdl|
//res://*/NBModel.ssdl|
//res://*/NBModel.msl";
string str = entityBuilder.ToString();
return str;
~~~调用 sharedCtx = new Model.SharedEntities(Connections.SharedConnectionString);
如果自己通过程序写链接字符串,有没有什么需要设置的?例如删除web.config中的链接字符串后,那怎么样调用自己写得链接字符串呢?根据这个重载来实例化?
/// <summary>
/// 初始化新的 DragonWFSqliteEntities 对象。
/// </summary>
public DragonWFSqliteEntities(string connectionString) :
base(connectionString, "DragonWFSqliteEntities")
{
this.OnContextCreated();
}
实例化时传入该string~~需要注意的是metadata要从相关的config中拷贝进来~