c#,asp.net,asp.net-mvc,asp.net-mvc-3,asp.net-mvc-4Related issues-Collection of common programming errors


  • user3085540
    c# mysql asp.net mysql-error-1064
    I got the following error while calling a stored procedure in asp.net c#page. I could not understand the error details. Please help me to solve this.MySqlCommand cmd =new MySqlCommand(“CALL sp_wrt_test(10, @param);SELECT @param”, connection);cmd.CommandTimeout = 5000000;//Assign the query using CommandType7 using (IDataReader reader = cmd.ExecuteReader()) {if (reader.Read())id = “@param = ” + reader[0]; }create procedure sp_wrt_test(in name varchar(100), out retval varchar(200)) begininsert into

  • Abi Ruban
    c# sql
    I am getting an error when trying to connect to SQL Database through C#:SqlConnection sqlc = new SqlConnection(“Server=sql09.freemysql.net,3306;Database=rekklamirajmee;Uid=trubilord;Pwd=******;”); sqlc.Open()When connecting through HeidiSQL, everything works, with the following settings:Advanced on default.I’ve been trying to fix it, have been Google-ing for over an hour but I cannot seem to fix it ;

  • remudada
    c# mysql
    This code is placed in the button. and when i click it to update the data, a messagebox error appears saying “fatal error encountered during command execution”. Your answers would be a great help. Thank youMySqlConnection connection = new MySqlConnection(MyConnectionString);MySqlCommand cmd;try{connection.Open();cmd = connection.CreateCommand();cmd.CommandText = “UPDATE student_offense SET TYPE=@TYPE,DATE_HAPPENED=@DH,DESCRIPTION=@DESC,SANCTION=@SANC” + “Where STUDENT_NO = @STUDENT_NO And DESCRI

  • user1033278
    c#
    How can I execute some code when my program experiences a fatal error and crashes? For example, something goes wrong and the box pops up that say “TestApp.exe has encountered an error and needs to close.” and then I want to write to a file with an error code and say a report of the last few things that were entered into the program. How would I do this in C#??

  • Sharpeye500
    c# asp.net mysql
    MySql.Data.MySqlClient.MySqlException:Fatal error encountered during commandexecution. —>MySql.Data.MySqlClient.MySqlException:Timeout expired. The timeout periodelapsed prior to completion of theoperation or the server is notresponding. atMySql.Data.MySqlClient.MySqlDataReader.NextResult()atMySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehaviorbehavior) — End of inner exceptionstack traceWhat does this error mean? I have max connection pool =200 in the connection string? my app i

  • JM.
    c# windows-services
    I created a windows service and installer that watches a collection of files for changes and copies any file that changes to a destination directory specified in the WatchlistConfig.xml file. I have a couple issues with the service: 1. It has stopped running on one occasion. (unacceptable) 2. We sometimes have to attempt to start the service several times before it “takes”.I believe issue #1 is probably due to not handling fatal errors in the application. I found a bit of code that I tried to

  • samaxI92
    c# .net obfuscation
    The class below causing –fatal error– after obfuscating with confuser(v1.9.0.0); I’m thinking its for bad/unsafe coding. I’m a beginner programmer. So it would be great if some-one point and describe the bad part(if exists) of my code. My IDE is VS-2010. Thanks. public class Check_COMgsm {public Exception ex;public List<string> ModemName;public List<string> ModemPort;public Check_COMgsm(){this.ex = null;this.ModemName = new List<string>();this.ModemPort = new List<string&g

  • C Sharper
    c# asp.net nhibernate mapping
    i have an error ( System.InvalidCastException: Unable to cast object of type ‘AccountProxy’ to type ‘System.String’.) when i did this codei mapped the tables( Account,AccountString,EventData,…) of the the database opengts ( open source) i have this error when i called a function from EventData.csIQuery query = session.CreateQuery(“FROM Eventdata”);IList pets = query.List();return pets;the Stack Trace:[InvalidCastException: Impossible d’effectuer un cast d’un objet de type ‘AccountProxy’ en typ

  • Clark Kent
    c# winforms web-browser clr fatal-error
    Possible Duplicate:Troubleshooting .NET “Fatal Execution Engine Error” My code is throwing a Fatal Execution Error. The exact error is this:The runtime has encountered a fatal error. The address of the errorwas at 0xed40646c, on thread 0x2044. The error code is 0xc0000005.This error may be a bug in the CLR or in the unsafe or non-verifiableportions of user code. Common sources of this bug include usermarshaling errors for COM-interop or PInvoke, which may corrupt thestack.I’m not using unsafe u

  • Darren Young
    c# minidump
    I want to write a utility that in the event of a fatal error, a minidump dmp file is created. I’m using the clrdump api and that seems fairly straightforward.What I wanted to know is, what should I be reading up on to determine how to trigger an event when there is a fatal error that allows for this minidump to be created.I will be writing it in C#.Thanks.

  • user3085540
    c# mysql asp.net mysql-error-1064
    I got the following error while calling a stored procedure in asp.net c#page. I could not understand the error details. Please help me to solve this.MySqlCommand cmd =new MySqlCommand(“CALL sp_wrt_test(10, @param);SELECT @param”, connection);cmd.CommandTimeout = 5000000;//Assign the query using CommandType7 using (IDataReader reader = cmd.ExecuteReader()) {if (reader.Read())id = “@param = ” + reader[0]; }create procedure sp_wrt_test(in name varchar(100), out retval varchar(200)) begininsert into

  • Chad
    asp.net sql-server iis-6 sql-server-2000 asp.net-3.5
    I’ve got a number of ASP.Net websites (.Net v3.5) running on a server with a SQL 2000 database backend. For several months, I’ve been receiving seemingly random InvalidOperationExceptions with the message “Internal connection fatal error”. Sometimes there’s a few days in between, while other times there are multiple errors per day.The exception is not limited to one site in particular, though they share business and data access assemblies. The error seems to always be thrown from SqlClient.TdsPa

  • Mark Cidade
    asp.net debugging iis
    I’ve a a customer using IIS and an application, developed by us, in Asp.NET 1.1. Monday, for 4 times in a row the error “A process serving application pool ‘xxxx’ suffered a fatal communication error with the World Wide Web Publishing Service. The process id was ‘yyyy’. The data field contains the error number.” appeared.Any idea about how to diagnose this? The only link I’ve found talks about installing low level debug tools but before proceeding in this kind of low level analysis I would know

  • Sharpeye500
    c# asp.net mysql
    MySql.Data.MySqlClient.MySqlException:Fatal error encountered during commandexecution. —>MySql.Data.MySqlClient.MySqlException:Timeout expired. The timeout periodelapsed prior to completion of theoperation or the server is notresponding. atMySql.Data.MySqlClient.MySqlDataReader.NextResult()atMySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehaviorbehavior) — End of inner exceptionstack traceWhat does this error mean? I have max connection pool =200 in the connection string? my app i

  • C Sharper
    c# asp.net nhibernate mapping
    i have an error ( System.InvalidCastException: Unable to cast object of type ‘AccountProxy’ to type ‘System.String’.) when i did this codei mapped the tables( Account,AccountString,EventData,…) of the the database opengts ( open source) i have this error when i called a function from EventData.csIQuery query = session.CreateQuery(“FROM Eventdata”);IList pets = query.List();return pets;the Stack Trace:[InvalidCastException: Impossible d’effectuer un cast d’un objet de type ‘AccountProxy’ en typ

  • Tapas Bose
    c# asp.net nhibernate spring.net mapping-resources
    I am new in .NET. I have used Spring Framework and Hibernate before in Java, but this is my first in .NET. To develop my application I am using Spring.Northwind solution as example. The hibernate mapping is:<hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″><class name=”EMSApplication.Domain.Employee, EMSApplication.Domain” table=”ems_Employees” proxy=”EMSApplication.Domain.IEmployee, EMSApplication.Domain” lazy=”true”><id name=”Id” type=”System.Int32″><column name=”Id” n

  • ell
    asp.net mono monodevelop dblinq xsp2
    I am trying to try DBLinq with the sqlite provider inside a simple ASP.NET web service. I am also using MonoDevelop 2.4 and Mono 2.6.7, The project in monodevelop references the DbLinq.dll which by default is set to be Local Copy. I can compile the webservice just fine. By when I try to run it from Monodevelop or using the xsp2 from the command line, xsp2 fails with a number of errors (see below). If I unchecked the Local Copy for the DBLinq.dll reference, xsp2 will execute but the Li

  • John Adams
    asp.net web-services coldfusion sax
    We are a small team with one ASP.NET web developer and one ColdFusion developer. Neither of us knows the other’s environment. I wrote an ASMX webservice using Visual Studio 2005 and a web application project in Visual Studio 2008 that successfully consumes the web service. But now we are trying to have my ColdFusion colleague consume the webservice and we are getting results we cannot interpret (except to surmise that the target webservice is not even being reached but that some “system layer” u

  • Bradley Lederholz Leatherwood
    asp.net razor mono nginx fastcgi
    Hello so I have been trying to get my website to run on mono (on ubuntu server) and I have followed these tutorials almost to the letter:However when my directory is not blank fastcgi logs reveal this: Notice Beginning to receive records on connection.Error Failed to process connection. Reason: Exception has been thrown by the target of an invocation.I am not really sure what this means, and depending on what I do I can get another error that tells me the resource cannot be found:The resource

  • Sabre
    c# asp.net .net internet-explorer
    I have a MVC web application that uses the 2010 report viewer. written in C# VS2010IE11 users are having difficulty loading the page containing the control, it sits indefinitely on the “Loading…” indicator.I have managed to track this down to others having similar issues with the user agent being the culprit.So to test I pulled up the development tools, changed the user agent to anything other than default, and viola, page loaded without issue.So all of the typical ways to address this such as

  • Jan Aagaard
    asp.net-mvc
    My web site crashes and simply returns a bland page when I use the TagBuilder class in my controller.The code works perfectly on my local machine, running Windows 7. I have tried with two different web hosts now, and they both have the same problem: A blank page if I use the TagBuilder class in code behind. I have made a workaround so that I simply build the tag string using String.Format, but I would of cause understand what the problem is, and then correct the error.I feel like I should provid

  • BenSwayne
    c# ajax asp.net-mvc signalr
    I have an ASP.NET MVC3 application.If my application had a large number of users – let’s say 100,000 – hypothetically, if all users were talking to each other and I used SignalR, would there be 100,000 long polling connections? Would these cause some sort of denial of service? Should I be using AJAX HTTP instead? Or would SignalR be smart enough to release the connection to resource pool when no activity is found for certain period of time? When would using signalR for chat be recommended for ch

  • amurra
    asp.net-mvc asp.net-mvc-4
    I have the need to manually instansiate some controllers and therefore have this code:var controller = Activator.CreateInstance(typeof(AccountController), repository) as AccountController;In the AccountController I have a method similar to this:[AllowAnonymous] [HttpPost] public ApiJsonResult LogOn(LogOnAccountDto model) {ValidateModel(model);if (ModelState.IsValid){//…} }I want my ModelState.IsValid to work, so therefore I call ValidateModel and pass it the model.This fails, apparently becaus

  • H.B.
    asp.net-mvc html5
    I am trying to set up a lightweight HTML5 Server-Sent Event implementation on my MVC 4 Web, without using one of the libraries available to implement sockets and similars. The lightweight approach I am trying is:Client side: EventSource (or jquery.eventsource for IE)Server side: long polling with AsynchController (sorry for dropping here the raw test code but just to give an idea)public class HTML5testAsyncController : AsyncController{private static int curIdx = 0;private static BlockingCollect

  • Mr Moo
    asp.net asp.net-mvc sql-server-2008 nhibernate ninject
    We have an ASP.Net 4 / MVC 3 hybrid web application which uses NInject 3 and (Fluent) NHibernate 3.2. DB is SQL Server 2008 R2. Server is 6-core 28 GB Windows 2008 64-bit server.Our customer has recently started testing the site using a spidering tool. As soon as the site experiences the load produced by the spider, our log starts to fill up with exceptions. We see a variety of errors from NHibernate, including some of the following:NHibernate.TransactionException: Commit failed with SQL excep

  • Benjamin
    c# asp.net-mvc model-view-controller active-directory
    I have an issue using c# on .Net 4 in a MVC web application, where when I query Active Directory, I frequently get an error: Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014).The strange thing is, that it will work flawlessly for a time, and then it will just start happening, and then just disappear again.I have made a few modifications to the function to get it to work , but they all seem to fail. I am wondering if I am doing something wrong, or if there is a bette

  • CR41G14
    c# .net asp.net-mvc asp.net-mvc-4 gzip
    Hi what I am trying to achieve is to compress an uploaded file and save this into the database then to decompress on download. I am using C# .NET MVC4.The system does deliver a file available to download, however when I try to open this file it is corrupt. This code works perfectly fine locally, there are no exceptions being thrown on the server and I do get a so I was wondering if anyone has had any issues with GZip on the server? I have had the server guys take a look and they have deemed

  • Joel Hansen
    c# asp.net asp.net-mvc ravendb
    Why can’t I make an embedded RavenDB work in a fresh asp.net MVC website?I have successfully tried and tested the following code in a simple .net console application. It works just fine, until I try and use it in an MVC website.It doesn’t throw any error, it just hangs after attempting to Initialize()In my bug-finding process, I installed a RavenDB server on localhost, which I can connect to in my MVC application – that is not a problem. But the initialize error was there before I installed the

  • Gohar
    javascript asp.net-mvc validation datetime validator
    I have a Custom Attribute for DateTime validation with given dateformat and also javascript validator which are provide me both client side and server side validation. But now I should change my datetime validation so that it would be performed according clients local DateTime format and I do not know how.I couldn’t find anything that help me.So please advise me how can I implement at least client side DateTime validation or how can I get client’s date format by javascript.

  • Jon Erickson
    asp.net-mvc structuremap godaddy
    I am getting a SecurityException (as seen below), even with [assembly: AllowPartiallyTrustedCallers] in my AssemblyInfo.cs.I am deploying to GoDaddy, which is a medium trust environment, which I don’t think StructureMap is set up to run under natively, although the 2.5.3 release notes mention adding the AllowPartiallyTrustedCallers attribute on the assembly level, it doesn’t seem to correct the issue.Is there a code example or something that will point me in the right direction? What am I missin

  • Davide.77
    asp.net-mvc-3 pdf fonts itextsharp font-face
    I’m not able to find a reason why my MVC 3 web site shows arabic font correctly and my pdf not.I use a bliss font in my web site;@font-face { font-family: ‘blissregular’; src: url(‘/Fonts/blissregular-webfont.eot’); src: url(‘/Fonts/blissregular-webfont.eot?#iefix’) format(’embedded-opentype’),url(‘/Fonts/blissregular-webfont.ttf’) format(‘truetype’); font-weight: normal; font-style: normal;}All working fine. After that I want to create the pdf of the output but arabic fonts does not appears.I’v

  • Jim
    asp.net asp.net-mvc asp.net-mvc-3 asynchronous
    I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file from network). What we want to do is:User clicks a button to post the form to trigger the process Application starts a new thread to start copying the file Application shows a message saying the file-copying process has begun User can close the browser while the copying processed and finished in the background.The idea is that the user doesn’t need any confirmation on the progress of the process, nor be

  • Kirk
    inversion-of-control asp.net-mvc-3
    We have recently upgraded a project to MVC 3 Tools and discovered that our inversion of control container is causing problems with the native MVC model binding validation on both client- and server-side. When we have the IoC hooked up the client validation fails to fire at all and the “IsValid” test in the controller fires erratically and passes along data when it should not. The only way we’ve been able to correct the validation framework is to disable the IoC completely. We were using Ninject

  • Cameron
    jquery asp.net-mvc-3
    I have the following JS:$(‘form’).live(‘submit’, function (event) {// Stop the form from doing a native postbackevent.preventDefault();$.ajax({type: ‘POST’,timeout: 5000,url: $(this).attr(‘action’),data: $(‘form’).serialize(),success: function (responseHtml) {$.getJSON($(this).attr(‘action’), function (data) {console.log(data);});},error: function (jqXHR, textStatus, errorThrown) {alert(‘server error’);}});});Which should log the json from the following mvc method on fail (note this is a login f

  • CD Smith
    vb.net asp.net-mvc-3 linq-to-sql .net-4.0
    I’ve read through the posts here and can’t find any eureka answers so here’s what I have. Linq to SQl not propagating a change back to the db.Here’s my code. Does anything stand out? The call to dc.GetChangeSet shows 0 changes. What am I missing? I can see the new values from “setting” being set to the cs object properties. SettingID is a primary key in my table and shows as PK in the dbml so that’s not an issue.Public Shared Function Update(ByVal setting As ClarifireSetup) As BooleanDim cs As

  • ekkis
    ajax asp.net-mvc-3 callback razor
    why do I always have so much trouble…? given that I didn’t solve the problem in my other article, I decided to just code the javascript right into the values… so I have:OnSuccess=”alert(‘ok’)”, OnFailure=”alert(‘failed’)”,so my problem is the submission works fine; a record gets inserted into the database and I get a callback… but I get the wrong callback! I get a failure even though the record got inserted. heeeeelp!

  • teahou
    asp.net-mvc-3 validation
    This has been asked and answered 100 times, and I have read them all, yet still my form submits after failing validation. I found a reference to not using jquery.validate higher than 1.9.0, so I rolled back to that (had been using 1.11) but no change.If i submit with an invalid form (nothing filled out) the error messages appear, then the form submits.I have successfully implemented validation a couple times in the past, and I can’t see what is different about this time. I need to take a break

  • Pat James
    asp.net-mvc asp.net-mvc-3 mobile 51degrees
    In my ASP.NET MVC 3 web application I am overriding the View name in a custom view engine to present a different view optimized for non-tablet mobile devices.All I want to perform this view override is an accurate value for Request.Browser.IsMobileDevice and the device’s native display width.51degrees.mobi feels very heavy and convoluted for this simple use case. Maybe that is just my frustration at trying to wade through all of the examples and documentation on the 51degrees web site to get an

  • EH_warch
    asp.net-mvc-3 sql-server-express asp.net-mvc-scaffolding
    I’m creating a new MVC 3 pilot application using Mvc3 and the MvcScaffolding NuGet, everything runs smoothly until i want to use the database i already have. The application keeps creating a database with the format:projectname.Models.projectnameContextI’m stuck in here, my connectionStrings is:<connectionStrings><add name=”ApplicationServices” connectionString=”data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true” providerNam

  • Christofer Eliasson
    c# asp.net-mvc-3 version-control entity-framework-4.3 ef-migrations
    I have an ASP.NET MVC3 project that uses Entity Framework 4.3 with the code-first approach. I use Migrations to keep the database up-to-date.The project is under source-control and I have a number of branches. What I just realized is that there will be a problem when I wan’t to merge one of my branches into the master. Since I have created migration-files in both branches, there will be overlapping migrations when I merge, which will probably cause conflicts.Is there a good way to manage Migrat

  • amurra
    asp.net-mvc asp.net-mvc-4
    I have the need to manually instansiate some controllers and therefore have this code:var controller = Activator.CreateInstance(typeof(AccountController), repository) as AccountController;In the AccountController I have a method similar to this:[AllowAnonymous] [HttpPost] public ApiJsonResult LogOn(LogOnAccountDto model) {ValidateModel(model);if (ModelState.IsValid){//…} }I want my ModelState.IsValid to work, so therefore I call ValidateModel and pass it the model.This fails, apparently becaus

  • CR41G14
    c# .net asp.net-mvc asp.net-mvc-4 gzip
    Hi what I am trying to achieve is to compress an uploaded file and save this into the database then to decompress on download. I am using C# .NET MVC4.The system does deliver a file available to download, however when I try to open this file it is corrupt. This code works perfectly fine locally, there are no exceptions being thrown on the server and I do get a so I was wondering if anyone has had any issues with GZip on the server? I have had the server guys take a look and they have deemed

  • dazedsnowboarder
    c# android asp.net-mvc asp.net-mvc-4
    I’m a first time poster so please excuse my ignorance on posting technique. I have been searching for hours and cannot seem to find the answer to this so hopefully the smarter people in the room can help? I have a web application written in .net MVC 4 that connects to several cloud service APIs. The user can then download files from this web app. I’ve been able to get this to work on all platforms except android. When I try to download the file on Android it hangs and eventually fails. While dow

  • PseudoNym01
    jquery-ajax post asp.net-mvc-4
    My ajax call looks like this$.ajax({ //actually approve or reject the promotionurl: url,type: “POST”,data: ‘{‘+data.PromotionId+’,’+data.UserId+’,’+data.ReasonText+’}’,dataType: “json”,//contentType: “application/json; charset=utf-8”,success: function (data) {if (indicator == ‘A’) {alert(‘Promotion approved successfully!’);}else {alert(‘Promotion rejected successfully.’);}var homelink = ‘<%: Url.Action(“Index”,”Home”) %>’;window.location.href = (homelink);returndata = data;},error: functio

  • j0k
    .net asp.net-mvc-4 mono asp.net-web-api
    I’m trying to get the new ASP.NET Web API beta (VS 2010 default Web API project) running on Ubuntu 10.04 with Mono 2.10.8.1. Unfortunately I failed miserably in all my attempts so far. The most “meaningful” exception I got is the following:System.TypeLoadException: Could not load type ‘RestTest.Controllers.ValuesController’ from assembly ‘RestTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type)at

  • Noel
    c# asp.net-mvc asp.net-mvc-4 asp.net-web-api asp.net-web-api-routing
    I created a new ASP.NET MVC4 Web Api Project. In addition to the default ValuesController, I added another controller, ScenarioController. It has the exact same methods as ValuesController. But for some reason, it behaves differently./api/values/ => “value1″,”value2” /api/values/1 => “value” /api/scenario/ => “value1″,”value2” /api/scenario/1 => “value1”,”value2″^^^^^^^^^^^^^^^^^should return “value”!Using breakpoints, I know that /api/scenario/1 actually gets sent to the public IEnu

  • UrbanPlanet
    jquery jquery-ui autocomplete asp.net-mvc-4
    List itemI am looking at the JQUERY example on the http://jsfiddle.net/g4stL/212/ link in Jsfiddle website. I am very impressed by the feature. Infact we have to implement the exact same feature on our application.If I copy the code as it is, I am able to see the multicolumn autocomplete. However the selection part does not work. If I select using mouse cursor or using Arrow keys the program fails. The error I get is “htmlfile: Unexpected call to method or property access.”In the append function

  • Rudi Visser
    asp.net asp.net-mvc asp.net-mvc-2 asp.net-mvc-4
    In ASP.NET MVC 2, the lifespan of an entry in the TempDataDictionary was just one HTTP Request.That translated to setting a value in one request, redirecting, and having access to the same item at the other end of the line. After this the entry would be no longer available, regardless of whether you read the value out of the dictionary at the latter end of the line or not.Since ASP.NET MVC 3 (I believe), this implementation detail has changed quite significantly.Entries in the TempDataDictionary

  • Saroj
    .net asp.net-mvc web-services wcf asp.net-mvc-4
    I need to write a method which retrieves data from db and need to pass this data to web controller. I have written a method in WCF and calling this method from web controller in MVC 4.But it is giving exception: This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). Inner Exception: The underlying connection was closed: An unexpected error occurred on

  • Mike Wills
    c# asp.net-mvc-4
    I am making a call to a Web API that I wrote. I am working through the bugs on both sides and am getting a 500 error. I want to see that is in that error message to see what might be the problem. How do I find that?using (var client = new HttpClient()) {var fooURL = Url.RouteUrl(“PayrollApi”, new { httproute = string.Empty, controller = “LeaveRequest” }, Request.Url.Scheme);var repsonse = client.PostAsJsonAsync(fooURL, leaveRequest).Result; }I don’t see where that text might be stored so I can f

Web site is in building