VS2005 (C #) Project Debugging Solution Collection

Source: Internet
Author: User
Tags bind empty iis include insert sql error tostring visual studio
Solve | problem | project

  1. A potentially dangerous Request.Form value was detected

Reason:

(1) The ValidateRequest property is not properly set on the page or webconfig on which the data is submitted

(2) The HTML inside wrote two causes

Solve:

Scenario One: Add this sentence to the header of the. aspx file: <%@ Page validaterequest= "false"%>

Programme II: Modification of the Web.config file:

<configuration>
<system.web>
<pages validaterequest= "false"/>
</system.web>
</configuration>

Because the default value of ValidateRequest is true. Just set to false.

  2. "Invalid read attempt in the absence of any data" solution

Reason:

The returned SqlDataReader have no data records, but are not treated as a record of judgment. Returns a null value

Plus judgment: if (Reader.read ()) {Textname.text =

reader["FieldName"]. ToString (); }

  3. The data is empty. This method or property cannot be called on null values.

Reason:

If the object is null, then the method of invoking the object, such as ToString () is definitely an error, usually the value of the database field is null

Data controls such as Grideview often appear

WORKAROUND: Therefore, null processing is recommended

  4. The FieldCount attempt is invalid when the reader closes

Reason:

After using the SqlDataReader to bind the data, the connection object is treated as close ()

Similar

Public SqlDataReader getsomething ()
{
Conn.Open ();
SqlDataReader reader =
sqlcmd. Excecutreader (commandbehavior.closeconnection));
Conn.close ()///occur error here
return reader;
}

This method is called when binding to specify the data source. If you use this method, you need to close the re in the calling function

Ader So conn can be closed automatically.

If you are using SqlDataAdapter and datasets, remove the call that explicitly closes the Conn. or in finally

Called in.

  5. Failed to map path

Cause: May be caused by incorrect path configuration in Webconfig

<add key= "Fckeditor:basepath" value= "~/admin/fckeditor/"/>

<add key= "Fckeditor:userfilespath" value= "/userfiles/"/>

  6.Unreachable Code Detected

Reason:

Typically, the throw or return is used when the exception is handled or returned, possibly in front of it, causing the following code to execute.

Solve:

Put the associated exception-throwing statement (throw) or return statement on the last line of the agent execution.

  7. Index out of range. Must be non-negative and less than the collection size

Reason:

(1). DataKeyField set as the corresponding unique field in the database (typically primary key)

(2). Datagrid1.columns > E.item.cells

Solve:

(1). Set DataKeyField

(2). Add Judgment Statement Datagrid1.item.count (DataGrid can be other similar server controls)

  8. The data is empty. This method or property cannot be called on null values

  9. Data source does not support server-side paging of data

Workaround:

Do not use DataReader, change to use dataset: or use custom paging, do not use the paging functionality provided by vs.net

OleDbDataAdapter da = new OleDbDataAdapter (sql, connection);
DataSet ds2 = new DataSet ();
Da. Fill (DS2, "News");
Gridview1.datasource = DS2;
Gridview1.databind ();

  10. The object name ' * * * * is invalid

Reason: This table is not present in the database currently in use

Workaround: See if the program has written the name of the table you called or whether the table you called is present in the SQL database

  11. An error occurred while establishing a connection to the server. When connecting to SQL Server 2005, the default settings for SQL

This failure may be caused by the Server not allowing remote connections. (provider: Named pipe provider,

ERROR:40-Unable to open connection to SQL Server

Solution: A fixed IP address or server address is required on the host

  12.SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM

Between.

This problem occurs ' mostly because you update the database ' DateTime field value is empty ' by default insert January 01 01

Day ' ' causes datetime type Overflow

  13. The appearance of the-------represents "properties", where the "method" should be

Reason:

1.VB method with C #, the format of the property is different.

2. It is possible that the syntax for binding data in design is incorrectly resolved: 1. Remember that attributes are used with the [] method ()

3. Remember the correct syntax for binding data (in several ways:: <%container.dataitem ("field name")%> <%

#Eval ("field name")%><%bind ("field name")%>, etc.)

  14. Failed from the Assembly "DAL, version=1.0.0.0, Culture=neutral,

Publickeytoken=null the "load type" DAL. SqlHelper ".

Reason: Failed to recompile to DLL after other layers have been modified

Resolution: Compile (Rebuild)

  15. Too many parameters specified for a procedure or function

Solution: The number of parameters used to invoke stored procedures with defined stored procedures or the incoming arguments in the executed SQL statement

Inconsistent number of numbers (this is a SQL error)

Solution: Carefully examine the parameter variables that are set in the stored procedure and correspond to the actual input parameter values of one by one

  16. Unable to start debugging, invalid binding handle

Cause: The system's Terminal Services are not open

  17.Unable to debugging on the Web server. Debug failed because Integrated Windows authentication is not enable

Workaround:

Open the Vs2005-> tool (Tools)-> option-> Debugging (Debugging)-> Edit and Continue (Edit and Continue)-> all tick

  File name or class name not found in 18.Automation operation: ' RegExp '

Workaround: regsvr32 vbscript.dll

  19.system.nullreferenceexception: Object references are not set to an instance of an object.

Reason:

(1) The variable being set is NULL or does not have a value, typically occurs when passing parameters, and also occurs when using data controls such as the DataGrid or GridView or DataList.

(2) The control name does not correspond to the codebehind inside

(3) Initialization of object not with new

(4) The control referenced in the program does not exist

Workaround:

(1) Use Try ... Catch...finally catch the error, or output the variable value directly with Response.Write ()

(2) To see if there are any uninitialized variables in the code

  20. Error 1718. File is rejected by digital signature policy (when VS2005SP1 is installed)

Workaround:

(1). Click Start, click Run, type Control AdminTools, and then click OK.

(2). Double-click Local Security Policy.

(3). Click Software Restriction Policy. (Note: If the software restrictions are not listed, right-click Software restriction Policies, and then click New Policy.) )

(4). Under Object type, double-click coercion.

(5). Click All users except local administrators, and then click OK.

(6). Restart the computer.

Microsoft notes:

http://support.microsoft.com/kb/925336

  21.vs2005 cannot switch from source file mode to view mode

Solution: Under DOS run under devenv/resetskippkgs (win+r cmd)

  22.Validation of ViewState MAC failed

Workaround: Page with enableviewstate= "false" enableViewStateMac = "false" to solve the problem

  23.Automation server can ' t create object ' (Automation server cannot be created right)

Solution: Run: Regsvr32 Scrrun.dll can be.

  24. Package Load failed

The package "Visual Web Developer Trident Designer Package" was not loaded correctly (GUID =

{30ae7e28-6c02-496d-8e43-85f7a90aeff1}.

Workaround:

1. Set the system variable Vslogactivity=1

2, create the file under the%appdata%\microsoft\visualstudio\8.0\ folder Activitylog.xml

Error

Microsoft Visual Studio

LoadLibrary failed for package [Visual Web Developer Trident Designer Package]

{30AE7E2B-6C02-496D-8E43-85F7A90AEFF1}

-------------------------------------------------

8007007e

C:\Program Files\Microsoft Visual Studio 8\common7\packages\tridsn.dll

3. Copy files from winnt\microsoft.net\framework\v2.0.xxx gdiplus.dll to program files\visual Studio 8\common7\packages folder

4. Run the command at the command line: devenv/resetskippkgs

  25.Error spawning ' cmd.exe '.

Solution: Copy the Cmd.exe to the Vc/bin directory under the VS installation directory to solve the problem.

  26. Attempt to read or write protected memory

Resolution: Hardware problems, general memory problems

  27. Unable to find the manifest signing certificate in the certificate store

WORKAROUND: Open the project's. csproj file with Notepad and delete the similar

  28. There is no target "ResolveKeySource" in the project.

Reason: This question is very rare, inquires the overseas related material, basically is because deploys is not a standard solution, needs to run the following this thing to restore in the VS from the command prompt

Workaround:

(1). Save the following code as an XML file named Testbuild.xml

<project defaulttargets= "Build" xmlns= "http://schemas.microsoft.com/developer/msbuild/2003" >

<PropertyGroup>

<targetconnectionstring>data Source=.\sql2005%3buser id=sqluser%3bpooling=false%3bpassword=x</ Targetconnectionstring>

</PropertyGroup>

<ItemGroup>

<databaseproject include= "Database1\database1.dbproj"/>

<databaseproject include= "Database2\database2.dbproj"/>

</ItemGroup>

<target name= "Buildalldatabaseprojects" >

<msbuild

Properties= "targetconnectionstring=$ (targetconnectionstring)"

Projects= "@ (DatabaseProject)"

targets= "Build;deploy" >

</MSBuild>

</Target>

(2) run in command prompt: Msbuild/t:buildalldatabaseprojects testbuild.xml

  29. Cannot insert value NULL into column ' * * '

Reason: This is a database table design error, the table involved in the field has set the NOT NULL attribute, but the passed value is null, so the error

Workaround: See if the value passed in is null, or modify the properties of the column corresponding to the table in the database

  30. Failed to load type "namespace. Class" ...

Reason:

(1) The project has not been compiled after the modification

(2) Some of the namespaces in the project may have been modified

(3) The required ascx or other pages in the project do not exist or are not included in the project

Workaround:

(1) Rebuild or compile the entire project or solution after the modification is complete

(2) Manually modify the namespace changed, pay attention to the case of the name, and then recompile

(3) Include related files in the project

  31. Cannot access read-only file "****.***"

Solution:

Add "everyone/write" permission to the file corresponding to the virtual directory

  32. Request failed for HTTP status 401: Access Denied

Workaround: Anonymous access on the IIS Information Server and allow IIS to control the password on the hook



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.