Wednesday, February 14, 2007

Error while trying to run project: Unable to start debugging on the web server

Following are the common errors when both ASP.NET 2.0 as well as 1.1 installed on the same machine. Find the solution below

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

Solution:

1) check in web.config
2) Open IIS and select your web project.
3) Right click you project and go to Properties.
4) See the Directory tab. Make sure that under Applicaiton Settings, you project has an application name (and not Default). If you see Default written there, then click the Create button.Run your project again.

This error can also surface in VS 2003 if you have deleted the Web.Config file from the project. Though the project will compile and you can run the app from the browser by directly typing the form url (like
http://localhost/WebApp1/WebForm1.aspx), but VS 2003 will not be able to run the app and will give the same error as above. The reason for this being the fact that in the absence of the app specific Web.Config file, ASP.NET will pick up settings from the machine.config file (under C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG). In this file we have DEBUG=FALSE in the compilation property, and if we change it manually and set it to TRUE, the app will run from VS 2003.

Error while trying to run project: Unable to start debugging on the web server.


Solution:

If you get this error, then first check if you have both ASP.NET 2.0 as well as 1.1 installed on the same machine or not. If yes, then open your porject in IIS, rgiht click and go to properties and see the ASP.NET tab (its will be there only if ASP.NET 2.0 is installed). Now check the version of the ASP.NET here and make sure you are using the right one. For VS 2003, it should be set to 1.1.

Error while to run project : unable to start debugging on the web server. Debugging failed because integrated window autherication is not enabled.


Solution:
Go to IIS->right click your Virtual directory->Properties->Directory Security tab->click Edit button->Make sure that Intergrated Windows Authentication button is checked.

Tuesday, February 06, 2007

Check network connection status using C#.net

Check network connection status using C#.net
Simple way to check network connection check the code below.
using System;
using System.Runtime.InteropServices;
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
//Creating a function that uses the API function...
public static bool IsConnectedToInternet()
{
int Desc;
return InternetGetConnectedState(out Desc, 0);
}
//Use function
if (IsConnectedToInternet())
{
MessageBox.Show("Netwok Connection Up");
}
else
{
MessageBox.Show("Sorry! Network Connection down.");
}

Ritesh Kumar Kesharwani
Cell : 91-9890901287

Error:"internal 500 error” when you access http://localhost

Error: "internal 500 error" when you access http://localhost
Try this first
If above solution does not work another solution
It works perfectly fine if you install the same in following order
  1. IIS
  2. .net
  3. Win XP SP2
Reason for the Error:-
If IIS gets installed after SP2, IIS does not server ASP or ASP.net pages. But IIS responds to plain HTML pages.
IIS depends upon COM+. And COM+ depends upon MSTDC (Distributed Transaction Server).
The reason for the error is MSTDC and COM+ link got corrupted and cannot contact MSDTC
Solution:-
We need to
  1. re-install MSDTC
  2. Create IIS packages (optional, sometimes it works fine without doing this)
Solution:-
  1. Login as administrator account.
  2. Create a System Restore point (start->programs->accessories->system tools->system restore)
  3. make sure that local user accounts IUSR_MYSHECXXXXXD, IWAM_MYSHECXXXXXD are not locked/disabled
  4. click on start -> run type "services.msc"
  5. Stop and disable the following services
COM+ event system
COM+ System Application
  1. Closer services MMC and restart the machine.
  2. Open command prompt type the command %WINDIR%\System32\msdtc.exe –uninstall
  3. Open Registry Editor and then remove the following keys if they exist:

HKEY_CLASSES_ROOT\CID
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSDTC
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MSDTC
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\MSDTC

  1. Open command Prompt and type %WINDIR%\System32\msdtc.exe –install
  2. Once this task is performed properly, start the service COM+ event System as automatic
  3. Open registry editor and create a registry key (NOT A VALUE)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\XADLL
  1. Type the following command in Command prompt
regsvr32 mtxoci.dll
  1. You will receive a message that DllRegisterServer in Mtxoci.dll succeeded.. Click Ok and Restart the machine.
  2. Login as administrator account and type the command in Command prompt %WINDIR%\System32\msdtc.exe –resetlog
  3. Open control panel->administrative tools->component services.
  4. Double click on component services , expand to component services->computers->my computer ->COM+ Applications
  5. You should be able to expand all the nodes in this window without any errors. If in case you get errors follow the below steps , else restart IIS with "iisrest" command and reboot the machine and check for http://localhost/
  6. If COM+ navigator throws errors, open command prompt and type the following commands
Cd %windir%\system32\inetsrv
rundll32 wamreg.dll, CreateIISPackage
regsvr32 asptxn.dll
  1. Then restart IIS( you can use "IISReset" command in command prompt)
  2. Restart the machine if it asks for

Ritesh Kumar Kesharwani
Infosys Tech. Ltd.