Я использую Entity Framework и oracle соединение в API, который работает хорошо локально, но на сервере IIS возвращает ошибку:
{"$ id": "1", "Сообщение ":" Произошла ошибка. "," ExceptionMessage ":" Указанный поставщик хранилища не найден в конфигурации или недопустим. "," ExceptionType ":" System.ArgumentException "," StackTrace ":" at System .Data.EntityClient.EntityConnection.GetFactory (String providerString) \ r \ n в System.Data.EntityClient.EntityConnection.ChangeConnectionString (String newConnectionString) \ r \ n в System.Data.EntityClient.EntityConnection..ring () r \ n в System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting (ConnectionStringSettings appConfigConnection) \ r \ n в System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig \ имя_системы .Entity.Internal.LazyInternalConnection.Initialize () \ r \ n
в System.Data.Entity.Internal.LazyInternalCo nnection.CreateObjectContextFromConnectionModel () \ r \ n в System.Data.Entity.Internal.LazyInternalContext.InitializeContext () \ r \ n в System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTy \ typeType) Data.Entity.Internal.Linq.InternalSet 1.Initialize()\r\n at
System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext () \ r \ n в System.Data.Entity.Infrastructure.DbQuery 1.System.Linq.IQueryable.get_Provider()\r\n
at System.Linq.Queryable.Join[TOuter,TInner,TKey,TResult](IQueryable
1 внешний, IEnumerable 1 inner, Expression
1 outerKeySelector, выражение 1 innerKeySelector, Expression
1 resultSelector ) \ r \ n в High_Levels.Controllers.TaskController.Tasks (Int32 userId, Int32 roleId) в C: \ Users \ RabeeA \ Desktop \ Back \ High_Levels \ Controllers \ TaskController.cs: строка 0 \ r \ n в lambda_method (Closure, Object, Object []) \ r \ n в System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor. <> C__DisplayClass10.b__9 (Экземпляр объекта, Object [] methodParameters) \ r \ n в System.Web.Http .Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute (экземпляр объекта, аргументы объекта []) \ r \ n в System.Web.Http.Controllers.ReflectedHttpActionDescriptor.Execu teAsyn c (HttpControllerContext controllerContext, аргументы IDictionary`2, CancellationToken cancellationToken) \ r \ n --- Конец трассировки стека из предыдущего расположения, где было сгенерировано исключение --- \ r \ n в System.Runtime.CompilerServices.TaskAwaiter. ThrowForNonSuccess (задача-задача) \ r \ n в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (задача-задача) \ r \ n в System.Web.Http.Controllers.ApiControllerActionInvoker.d__xt \ r (n) .Rove Конец трассировки стека от предыдущего расположения, где было сгенерировано исключение --- \ r \ n в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (задача задачи) \ r \ n в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (задача задачи) \ r \ n в System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext () \ r \ n --- Конец трассировки стека из предыдущего расположения, где было сгенерировано исключение --- \ r \ n в System.Runtime. CompilerServices.TaskAwaiter.ThrowForNonSuccess (Задача) \ r \ n в System.Runtime.CompilerServices.TaskAwaite r.HandleNonSuccessAndDebuggerNotification (Задача) \ r \ n в System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext () "," InnerException ": {" $ id ":" 2 "," Message ":" Ошибка произошло. "," ExceptionMessage ":" Невозможно найти запрошенный. Net Framework Data Provider. Возможно, он не установлен. "," ExceptionType ":" System.ArgumentException "," StackTrace ":" в System.Data.Common.DbProviderFactories.GetFactory (String providerInvariantName) \ r \ n в System.Data.EntityClient.EntityConnection. GetFactory (String providerString) "}}
Мой web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
<authentication mode="Windows" />
<identity impersonate="false" />
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="EB42632606E9261F" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!--<connectionStrings>
<add name="WF_Entities" connectionString="DATA SOURCE=TestDB2;PASSWORD=wf_engine123;PERSIST SECURITY INFO=True;USER ID=WF_ENGINE" providerName="Oracle.ManagedDataAccess.Client" />
<add name="HL_Entities" connectionString="metadata=res://*/Models.HL_Model.csdl|res://*/Models.HL_Model.ssdl|res://*/Models.HL_Model.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="DATA SOURCE=TestDB2;PASSWORD=high_levels123;PERSIST SECURITY INFO=True;USER ID=HIGH_LEVELS"" providerName="System.Data.EntityClient" />
</connectionStrings>-->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<!--<providers>
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>-->
</entityFramework>
<connectionStrings>
<!--<add name="HL_Entities" connectionString="metadata=res://*/Models.HL_Model.csdl|res://*/Models.HL_Model.ssdl|res://*/Models.HL_Model.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="DATA SOURCE=TestDB2;PASSWORD=high_levels123;PERSIST SECURITY INFO=True;USER ID=HIGH_LEVELS"" providerName="System.Data.EntityClient" />-->
<add name="HL_Entities" connectionString="metadata=res://*/Models.HL_Model.csdl|res://*/Models.HL_Model.ssdl|res://*/Models.HL_Model.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="DATA SOURCE=TestDB2;PASSWORD=high_levels123;PERSIST SECURITY INFO=True;USER ID=HIGH_LEVELS"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST,OPTIONS, PUT, DELETE" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, Authorization" />
</customHeaders>
</httpProtocol>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>