Pages

Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Thursday, September 3, 2009

Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

Error: Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

Cause: Either debug is not enabled in your web.config (OR) For some reasons IIS is not considering your web application as a virtual directory. Instead it is considering it to be a normal folder.

Solution 1:

Step 1: Open the web.config
Step 2: If debug is set to "false" change it to "True".

For example: In web.config I have a line like this I would change it to

If at all this doesn't work. Try out the next solution.

Solution 2:

1.From the Start menu, choose Programs, then Administrative Tools, and click Internet Information Services.

2.In the Internet Information Services dialog box, click the tree control for your machine, open the Web Sites folder, and find your web site.

3.Right-click Web Site and choose Properties.

4.In the Web Site Properties window, select the Directory tab.

5.Under Application Settings, look for the Remove or Create button. If the button says Remove, your website is already configured as an application. If the button says Create, click the button to configure your website as an application.

6.Click OK.

If it also doesn't work, try the next solution.

Solution 3:

If you are running Visual Studio 2003 (or ASP.NET v1.1) you should setup IIS to use ASP.NET v1.1 and not ASP.NET v2.0

May be you have installed .NET framework 1.1 as well as 2.0 in your box and trying to run an application via VS.NET 2003. If so, then do the following:

Step 1: Start >> Run >> inetmgr
Step 2: Navigate to the virtual directory of the project which is throwing this error.
Step 3: Right click on the virtual directory and choose "Properties"
Step 4: Choose the tab ASP.NET
Step 5: The first dropdown would read "ASP.NET Version", choose 1.1.4322


Solution 4 :

1. go to the C:\WINNT\Microsoft.NET\Framework\
2. and run aspnet_regiis.exe /i
That's it. Hope this helps.

Tuesday, June 30, 2009

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)



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.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


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.

Solution: viewview Solution

Cannot create/shadow copy [Project File Name] when that file already exists.

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.IO.FileLoadException: Cannot create/shadow copy 'Test.UI' when that file already exists.


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.


Assembly Load Trace: The following information can be helpful to determine why the assembly 'Test.UI' could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Solution :
visit View Solution

Friday, May 22, 2009

Reading last line in text file

StreamReader streamReader = new StreamReader("HereWillBeYourTextFilePath");
ArrayList lines = new ArrayList();

string line;

while ((line = streamReader.ReadLine()) != null)
{
lines.Add(line);
}
streamReader.Close();

if (lines.Count > 0)
{
Response.Write(lines[lines.Count - 1].ToString());
}

Shared Button