【发布时间】:2014-01-11 13:53:29
【问题描述】:
我将实体框架与 oracle 提供程序 (Oracle.ManagedDataAccessDTC) 一起使用
从 Visual Studio 运行它一切正常,但是当我将它发布到 IIS 时,我收到一个连接错误异常。
这是我的 webconfig 女巫在 Visual Studio 上工作得很好:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Model.Model.csdl|
res://*/Model.Model.ssdl|
res://*/Model.Model.msl;
provider=Oracle.ManagedDataAccess.Client;
provider connection string='DATA SOURCE=ORCL;PASSWORD=giovanni;USER ID=DB_ES'" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
这是我在 IIS 上遇到的错误:
Server Error in '/EA' Application.
ORA-12154: TNS:não foi possível resolver o identificador de conexão especificado
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: OracleInternal.Network.NetworkException: ORA-12154 could not resolve the connect identifier specified
Source Error:
Line 24: public List<CADASTRO> GetCadastroBy(string CPF, string Cartao)
Line 25: {
Line 26: return ent.CADASTRO.Where(x => x.CPF.Equals(CPF) && x.NUMEROSEUCARTAO.Equals(Cartao)).Select(x => x).ToList<CADASTRO>();
Line 27: }
来自 sql plus 的查询工作正常。
有什么想法吗?
解决方案:
<oracle.manageddataaccess.client>
<version number="4.121.1.0">
<settings>
<setting name="TNS_ADMIN" value="C:\app\giovanni.saraiva\product\11.2.0\dbhome_2\network\admin"/>
</settings>
</version>
</oracle.manageddataaccess.client>
在 webconfig 上。
【问题讨论】:
-
您应该隐藏任何敏感数据,例如 密码。
标签: c# oracle entity-framework oracle11g