I want to use the Model First workflow in Entity Framework with Oracle SQL.
I can create new elements into the db with the Create Controller, but when I want to display it I got a not so detailed TTC error message:
TTC Error
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.Exception: TTC Error
Source Error:
Line 18: public ActionResult Index()
Line 19: {
Line 20: return View(db.VALLALAT.ToList());
Line 21: }
Line 22:
Source File: ...\Controllers\VallalatController.cs Line: 20
I got this error with every model, that got a data in the SQL table
[Exception: TTC Error]
OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int64 initialLOBFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Int64[]& rowsAffectedByArrayBind, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause, List`1& implicitRSList, Boolean bLOBArrayFetchRequired) +3350
OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(Int32 noOfRowsToFetch, Boolean fillReader, Boolean returnPSTypes) +1511
Oracle.ManagedDataAccess.Client.OracleDataReader.Read() +1365
System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead() +36
[EntityCommandExecutionException: An error occurred while reading from the store provider's data reader. See the inner exception for details.]
System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.HandleReaderException(Exception e) +145
System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead() +49
System.Data.Entity.Core.Common.Internal.Materialization.SimpleEnumerator.MoveNext() +41
System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() +112
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +387
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
My enviroment:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
Entity Framework 6.0
Oracle.ManagedDataAccess & EntityFramework 18.3
Yay! I got the answer.
The Visual Studio generated me the table, with an NCLOB property. I changed the NCLOB to VARCHAR2 and now finally display the list correctly.
Update:
Don't forget to degrade the ODP.NET driver to 12.2 from 18.3
Degrade the ODP.NET driver to 12.2
Related
So, I'm trying to run an ASP.NET MVC 5 with NHibernate and FluentNHibernate targeting SQL Server 2012 with Visual Studio 2015 for Mac and XSP Webserver, and it fails with the exception below. I'm using .NET Framework 4.5 and packages are updated to the very last version.
System.ArgumentNullException
Value cannot be null.
Parameter name: type
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Core.
Exception stack trace:
at System.Dynamic.Utils.ContractUtils.RequiresNotNull (System.Object value, System.String paramName) [0x00003] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/external/corefx/src/Common/src/System/Dynamic/Utils/ContractUtils.cs:67
at System.Linq.Expressions.Expression.Convert (System.Linq.Expressions.Expression expression, System.Type type, System.Reflection.MethodInfo method) [0x0000b] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs:780
at System.Linq.Expressions.Expression.Convert (System.Linq.Expressions.Expression expression, System.Type type) [0x00000] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs:763
at NHibernate.Util.DelegateHelper.BuildPropertySetter[T] (System.Type type, System.String propertyName) [0x00015] in <1c5d1dfd6b734554b068885679d8b49d>:0
at NHibernate.AdoNet.SqlClientSqlCommandSet..cctor () [0x00019] in <1c5d1dfd6b734554b068885679d8b49d>:0
Maybe this is a NHibernate or FluentNHibernate bug?
I think I've found a solution. Because of a bug or something, we need to configure the database with a batch size of zero to avoid this exception:
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2012.ConnectionString(
x => x.FromConnectionStringWithKey("ConexaoBanco")).ShowSql())
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<HomeController>())
.ExposeConfiguration(cfg => cfg.SetProperty("adonet.batch_size", "0"))
.BuildSessionFactory();
I should give proper credit to sta-blockhead for the solution: http://sta-blockhead.blogspot.com.br/2009/06/systemdatasqlclientsqlcommandset.html
I recently upgraded a 2008 R2 Web server to .Net Framework 4.6.1. I then installed my ASP.NET MVC application on such which is built to .Net Framework 4.6.1. When I attempt to run the site, I get the following error.
External component has thrown an exception.
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.Runtime.InteropServices.SEHException: External component has thrown an exception.
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:
[SEHException (0x80004005): External component has thrown an exception.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +485
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +190
System.Reflection.Assembly.LoadFrom(String assemblyFile) +54
WebActivator.ActivationManager.get_Assemblies() +244
WebActivator.ActivationManager.RunActivationMethods() +86
WebActivator.ActivationManager.RunPreStartMethods() +46
WebActivator.ActivationManager.Run() +68
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: External component has thrown an exception..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +900
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +164
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +169
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +907
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: External component has thrown an exception..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726
I did same process on other similar servers and didn't hit an issue.
I did find that in IIS (which the site is running in), if I change the application pools "Load User Profile" setting to false then the site runs without a problem.
I don't just want to change this setting (unsure of its impact on the application), I would like to understand why I need to make such a change on this server and didn't need to on others. Was it the way the framework was installed or server is setup? Any feedback would be great.
(note: the server has version 4.5 installed and the site when built in such, ran without an issue)
I ran in this problem once, on many cases problem is due to some software in the dev suite that was not up to date. In my case the problem was caused due to Telerik justMock, The problem was resolved by updating justmock to latest version. Try to update or uninstall Telerik tools if you have one, Hope this solves your problem
External component has thrown an exception.
I had before similar problem after installing .Net Framework 4.6.1 - I have not figured out what component cause problem, but problem was related to missing .NET Framework 4.5.1 Targeting Pack.
Solution in my case:
uninstall all .NET Frameworks,
install .NET Framework 4.5.1 Developer Pack
install .NET Framework 4.5.2 Developer Pack
install .NET Framework 4.6.1 Targeting Pack
(the order is important)
All downloaded form official site: Targeting .NET Platforms
I'm receiving the following error within TFS
Exception Message: TF246021: An error occurred while processing your
request. Technical information (for administrator): SQL Server Error:
2601 (type VersionControlException) Exception Stack Trace: Server
stack trace: at
Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation
operation, TfsMessage message, Object[]& outputs) at
Microsoft.TeamFoundation.VersionControl.Client.Repository5.LabelItem(String
workspaceName, String workspaceOwner, VersionControlLabel label,
LabelItemSpec[] labelSpecs, LabelChildOption children, Int32
maxClientPathLength, Failure[]& failures) at
Microsoft.TeamFoundation.VersionControl.Client.WebServiceLayer.LabelItem(String
workspaceName, String workspaceOwner, VersionControlLabel label,
LabelItemSpec[] labelSpecs, LabelChildOption children, Failure[]&
failures) at
Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.CreateLabel(VersionControlLabel
label, LabelItemSpec[] itemSpecs, LabelChildOption options, Failure[]&
failures) at
Microsoft.TeamFoundation.Build.Workflow.Activities.TfLabel.TfLabelInternal.RunCommand(VersionControlScope
versionControlScope, String nonFatalError, VersionControlLabel label,
IEnumerable`1 items, LabelChildOption childOption) at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Object[]& outArgs) at
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage
msg, IMessageSink replySink)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
reqMsg, Boolean bProxyCase) at
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData) at System.Func6.EndInvoke(IAsyncResult
result) at
Microsoft.TeamFoundation.Build.Workflow.Activities.TfLabel.TfLabelInternal.EndExecute(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor
executor, BookmarkManager bookmarkManager)
Inner Exception Details:
Exception Message: TF246021: An error occurred while processing your
request. Technical information (for administrator): SQL Server Error:
2601 (type SoapException)SoapException Details: Exception
Stack Trace:
I've read a previous post within StackOverflow which points at recreating workspaces, I tried that and it doesn't work.
Also I've tried to clean the cache, again without any luck. One thing I noticed when I go and disable 'Label Sources' and run the a build it works. I believe its to do with creating a branch and then deleting some files from a main branch which then gets TFS into a mess. I'm not sure whats the best way to fix this, it'll be difficult to upgrade to a newer version of TFS.
Make sure your TFS 2012 has been upgraded to the latest edition Update 4.
Make sure the build server has the same edition with TFS Application Tier.
Make sure both client cache and server cache are cleaned. Client cache: C:\Users\username\AppData\Local\Microsoft\Team Foundation\4.0\Cache. Server cache: C:\ProgramData\Microsoft\Team Foundation\Web Access\Cache_v11.0
Check Event log in Event Viewer to see whether there is something helpful.
In one of our products we retrieve data from the Oracle database using stored procedures using the ODP.net managed driver.
Every now and then (roughly every 1000 queries) we get the following exception:
(ORA-12570: Network Session: Unexpected packet read error)
---> Oracle.ManagedDataAccess.Client.OracleException: ORA-12570: Network Session: Unexpected packet read error
---> OracleInternal.Network.NetworkException: ORA-12570: Network Session: Unexpected packet read error
---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: size
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
at OracleInternal.Network.ReaderStream.ReadIt(OraBuf OB, Int32 len)
--- End of inner exception stack trace ---
at OracleInternal.Network.ReaderStream.ReadIt(OraBuf OB, Int32 len)
at OracleInternal.Network.ReaderStream.WaitForReset()
at OracleInternal.Network.OracleCommunication.Reset()
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int32 initialLOBFetchSize, Int64[] scnFromExecution, Boolean& bAllPureInputBinds, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause)
--- End of inner exception stack trace ---
at Oracle.ManagedDataAccess.Client.OracleException.HandleError(OracleTraceLevel level, OracleTraceTag tag, Exception ex)
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int32 initialLOBFetchSize, Int64[] scnFromExecution, Boolean& bAllPureInputBinds, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause)
at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int32 lobPrefetchSize, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Boolean isFromEF)
at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
It seems like ODP.net is calling System.Net.Sockets.Socket.Receive with an invalid size parameter (<=0 or greater than the length of buffer minus the value of the offset parameter).
The exception cannot be reproduced manually and is never raised while executing different procedures with different parameters (ie it's random).
Configuration:
ODP.net managed driver version: 4.121.1.0
.net framework 4.5
Oracle server version: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 (Linux)
Has anyone already experienced this issue? Are there any fixes available?
Thanks in advance!
After opening a ticket with the Oracle support, they sent an unofficial updated version of the managed ODP.net library which seems to fix the issue.
Hopefully the fix should be part of the next ODAC release (the latest available today is from Oct 2015).
If you see this error in your application, it's probably due to the same bug in the managed ODP.net library, not the way you use it.
Another thing to consider is if something in the network infrastructure could interrupt idle tcp/ip connections during the execution of long requests as described in this SO answer.
After reading through a similar question at ODP.NET Oracle.ManagedDataAcess random ORA-12570 errors, it seems like it's actually a pooling problem. Apparently the answer is to either set Pooling=false in the Connection String, or to find out just how many threads can be opened and how long the connection can be open before it becomes too much for Oracle to handle. This was the answer the author of that question posted:
To find the best configuration with pooling enabled I created a test application to start 50 threads (each one doing 1 test each 50ms), and decreased the default pool values until the error stoped. This way I was able to get an optimal configuration, stable, without any errors.
Obviously it does not applies to every server, but this is my final connection string configuration:
Pooling=true;Min Pool Size=1;Connection Lifetime=180;Max Pool Size=50;Incr Pool Size=5
The application is working well in Win server 2003 /IIS 6.0 environment.
When I move the code to win server 2008/IIS 7.0 , I am getting below error? Could you advise what is the error cause? Did i missed anything?
Server Error in '/' Application.
Arithmetic operation resulted in an overflow.
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.OverflowException: Arithmetic operation resulted in an overflow.
Stack Trace:
[OverflowException: Arithmetic operation resulted in an overflow.]
System.IntPtr.ToInt32() +37
CoreLab.Common.a.a(Delegate A_0) +1935
CoreLab.Oracle.ab.a(OracleConnection A_0) +214
CoreLab.Oracle.OracleConnection.Open() +375
MonsterWorldwide.iTime.DataAccess.TimecardDA.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal) in c:\inetpub\wwwroot\mtitimeproduction\dataaccess\timecardda.cs:28
MonsterWorldwide.iTime.BusinessLogic.TimecardBL.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal) in c:\inetpub\wwwroot\mtitimeproduction\businesslogic\timecardbl.cs:24
MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.LoadData() in c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:112
MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:52
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927
[OverflowException: Arithmetic operation resulted in an overflow.]
System.IntPtr.ToInt32() +37
CoreLab.Common.a.a(Delegate A_0) +1935
CoreLab.Oracle.ab.a(OracleConnection A_0) +214
This looks like some poorly written unmanaged interop code which doesn't take into account the CPU type and which blows when run in a x64 bit OS. In a 64-bit OS pointers are 64-bit integers contrary to 32 bit OS.
Maybe you should check the documentation of this CoreLab.Common component you are using whether it supports 64-bit systems.
Quote from the documentation of the IntPtr.ToInt32 method:
OverflowException: On a 64-bit platform, the value of this instance is too large or too small to represent as a 32-bit signed integer.