.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Application Exception Rule Violation thrown on Delete

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
I basically have my first simple asp.net MVC 2.0 web application up and running except for deletes. I tried to do the first delete today, but it throws an exception with the text Rules Violation.  I'm not sure what is causing the error however.It shouldn't be the database (I don't think) because when I trace the database, I never see the delete call and after having it fail, I was able to sucessfully run:DELETE FROM [Work] WHERE work_id = 84 GOCurrently this is my method (yes its primitive, but I was just trying to get it working), its the db.SubmitChanges() line where the application exception gets thrown. [HttpPost] public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here var result = db.Works.SingleOrDefault(w => w.work_id == id); if (result == null) return View("NotFound"); db.Works.DeleteOnSubmit(result); db.SubmitChanges(); return RedirectToAction("Index"); } catch { var result = db.Works.SingleOrDefault(w => w.work_id == id); return View(result); } } }This may be a Linq-to-Sql issue as this is really the first time I've us

View Complete Post

More Related Resource Links

Timout Exception thrown by MOSS 2007 web application


Dear All,

I have a SharePoint Farm with two front end servers , one application server also working as front end server (i.e holding the central admin and my applction), while my database is on a separte DB cluster.

We are getting the following alerts very frequently nowadays from a operation monitor software instlled on these servers:


System.ApplicationException: This operation returned because the timeout period expired. (Exception from HRESULT: 0x800705B4)

System.Threading.ReaderWriterLock.AcquireReaderLockInternal(System.Int32 millisecondsTimeout)
Microsoft.SharePoint.Utilities.SPInitializeOnceLock..ctor(System.Boolean readerLock)
Microsoft.SharePoint.Administration.SPVolatileCache`2[K,V].GetValue(K key)
Microsoft.SharePoint.Administration.SPCache`2[K,V].get_Item(K key)
Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl(System.String name, System.Boolean

Enterprise Library: Take Exception To Critical Errors With Custom Application Blocks


Enterprise Library is a collection of application functionality blocks that you can re-use in your application for common functionality you'd otherwise have to write again and again. Here Jay Hilyard explains how to use them.

Jay Hilyard

MSDN Magazine September 2006

Error Handling: Throwing Custom Exception Types from a Managed COM+ Server Application


Exception handling semantics in .NET are based on type, so you can create custom exceptions that have their own properties and methods. In .NET, exceptions are first-class citizens, and since they're the built-in error handling mechanism, all .NET-compliant languages must support exceptions. In addition, COM+ services are available to .NET code as Enterprise Services, so you can leverage exceptions in your Enterprise Services design.In this article the author describes custom exceptions, throwing exceptions across COM interop boundaries, and working with Enterprise Services.

Bob DeRemer

MSDN Magazine March 2004

'System OutOfMemory Exception' while using rdlc in Windows application

hi Everyone , I am Using Reporting Service (.rdlc) in my Windows application , i am getting Error System OutOfMemory Exception Like "an error occured during local report processing An Unexpected error occured in Report Processing Exception of type 'System OutOfMemory Exception'Was Thrown " what to do Please anyone help me ... Advance Thanks Anilmarnal

how can we show error in our application when exception occur in webs service

how can we show error in our application when exception occur in webs service

Delete Application

I get the error message: An object of the type Microsoft.SharePoint.Administration.SPIisWebsiteUnprovisioningJobDefinition named "Unprovisioning EISPortal" already exists under the parent Microsoft.SharePoint.Administration.SPWebService named "".  Rename your object or delete the existing object. when I try to delete a web application. The reason I am trying to delete the application is that I was unable to browse it. Any troubleshooting assistance will be appreciated. I also deleted the shared services provider hoping it would delete any websites in it. Thank you.

Delete web application

In a 1 WFE + 1 Indexer + 1 cluster SQL server environment, I was creating a web application through central admin. After the web app got created I noticed that I don't see the IIS website in the WFE although I am seeing it in Index server. I noticed that wss timer service was stopped in the WFE and restarted it. Then I killed the provisioning task from timer job definitions. Now I am not able to see the web app in the Central Admin (List of web applications). When I am trying to create an alternate web app using the same host header, SharePoint is complaining  "Your URL" is already routed to the Default zone of another application. Remove that mapping or use a different URL.  How can I remove the mapping unless I can see the web app in Central Admin? Thanks

Exception of type 'System.ExecutionEngineException' was thrown.

Hi,       I am showing a WPF Window as ShowDialog().  Before loading the window, we are showing a message box. Upon Pressing Cancel Button from the Message box, Application throws "Exception of type 'System.ExecutionEngineException' was thrown.".. While cancelling, Events are raised to close the Window.. If we comment that code, window will be in the open state, other wise will "Throw the error". Please help me!!!!!!!!!  

How to delete incomplete Search Application?

I messed up a parameter value in my PowerShell script to create a Search application.   It is partially created and trying to activate.  [ Admin and Crawl databases created with associated registry entries, but query and proxy were not created.]  I see reference on the web for a CancelActivation method that can be used from VB or C#, but I have not been able to find anything in PowerShell to help.   Attempts to delete the search application via the GUI or remove it with PowerShell just sit there until the nightly recycle of the application pools cancels the process. This is Search Server 2010 Express so all components are on the same server.  I have been able to successfully create a second search application so the users have search functionality, but I need to be able to remove the incomplete one.   Any help would be greatly appreciated! Central Admin search management page says "did not finish loading" (and topology and crawl status just have the spiny spinning forever) Event log entries occur about every minute: Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (fba8ced3-8939-4463-8159-de4fea83a618). Reason: The search application '578b7ed5-520a-41f3-abd4-194bc622a827' on server CACGIS09 did not finish loading. View the event

Exception has been thrown by the target of an invocation.

hi!! i am new to this,please help me with this when i use this,,,,image.Source = new BitmapImage(new Uri(str, UriKind.RelativeOrAbsolute));  it is working but when i use array of images and use  image[0].Source = new BitmapImage(new Uri(str, UriKind.RelativeOrAbsolute)); it gives me error  Exception has been thrown by the target of an invocation.   thanks

How to create a Custom Exception Handler using Micorosft Exception Handling Application Block?

Dear Friends,Can any one let me know "How to create a Custom Exception Handler using Microsoft Exception Handling Application Blocks"I will be having a set of Exceptions which will be getting maintained in an XML File along with the User Friendly Messages for a particular Exception. Whenever an Exception occurs in the projects first it need to check with the Exceptions present in the XML File and need to display the concerned user friendly message for that particular exception to the user..I am not able to get an idea on "How to start with the Microsoft Exception Handler Application Block" to achieve this". Please help me in this regard...Thanks and Regards,G.V.N.Sandeep.

an unhandled exception occurred in the silverlight application sharepoint 2010

An unhandled exception occurred on the page when Try to create the Announcement List in SP 2010 site which is upgraded from SP 2007,Any body have faced this issue?

Exception of type 'System.OutOfMemoryException' was thrown.

Hi, i am just using select stmt from some view. view defination is also selecting columns from inner join of 3 tables. view count is about 46 millions records. so while selecting from view it gives me: Exception of type 'System.OutOfMemoryException' was thrown. same error occur if i use direct select from those tables instead of select * from view. What is the reason behind this. Any help will be appreciated. Thanks Punia

need help about Exception of type 'System.Web.HttpUnhandledException' was thrown.

Hi Friends

I am developing a website in which i am using services of a third party service providers. after some transactions on their pages they are transfering control to my page say page1.aspx. 

But when the control is transfered to my page there is an exception /Runtime error..

I am unable to trace this error. I had tried to log all the errors. Where I found this error.

3/19/2010 3:34:44 AM
Offending URL: http://www.mydomain.com/ThankYou.aspx Source: System.Web Message: Exception of type 'System.Web.HttpUnhandledException' was thrown. Stack trace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.thankyou_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5910a9b6\ab96f081\App_Web_upsitg7y.0.cs:line 0
at System.Web.HttpApplication.CallHandlerEx

Exception thrown when handling Window.Loaded event


Why is the exception assistant not "fired" in a debugging session when a Window.Loaded eventhandler calls code which throws an exception ?
        private void Window_Loaded(object sender, RoutedEventArgs e)
            //Application.Current.DispatcherUnhandledException +=
               new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
            int a = 1;
            int b = 0;
            int c = a / b;

        void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)

Removing the comment signs (//) thus presenting an UnhandledException handler devinately makes the assistant "firing".
Is this behaviour by desi

Release mode application throws Break instruction exception - code 80000003 when running in WinDbg


Here is the initial output of my program after running it from WinDbg:

CommandLine: "C:\Documents and Settings\Administrator\My Documents\Work\QMI_Test_Tool\QMI_UT_Source\Release\QMI Validation Tool.exe"
Symbol search path is: SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00400000 0048f000  QMI Validation Tool.exe
ModLoad: 7c900000 7c9b2000  ntdll.dll
ModLoad: 79000000 7904a000  C:\WINDOWS\system32\mscoree.dll
ModLoad: 7c800000 7c8f6000  C:\WINDOWS\system32\KERNEL32.dll
ModLoad: 77dd0000 77e6b000  C:\WINDOWS\system32\advapi32.dll
ModLoad: 77e70000 77f03000  C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fe0000 77ff1000  C:\WINDOWS\system32\Secur32.dll
ModLoad: 7c420000 7c4a7000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\MSVCP80.dll
ModLoad: 78130000 781cb000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\MSVCR80.dll
ModLoad: 77c10000 77c68000  C:\WINDOWS\system32\msvcrt.dll
ModLoad: 7c9c0000 7d1d7000  C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77f10000 77f59000  C:\WINDOWS\system32\GDI32.dll
ModLoad: 7e410000 7e4a1000  C:\WINDOWS\system32\USER32.dll
ModLoad: 77f60000 77fd6000  C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 7c4c0000 7c53d000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\m

Exception thrown from workflow



I got following exception in my workflow.

Type : System.Exception, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : #################(Exception Start)#####Transaction (Process ID 115) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.,
Workflow Manager,WFStart,0,
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.HasMoreRows()
   at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)
   at System.Workflow.Runtime.Hosting.PersistenceDBAccessor.RetrieveStateFromDB(DbCommand command, Boolean checkOwnership, Guid instanceId)
   at System.Workflow.Runtime.Hosting.PersistenceDBAccessor.RetrieveInstanceState(Guid instanceStateId, Guid ownerId, DateTim

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend