Blog Stats
  • Posts - 42
  • Articles - 0
  • Comments - 61
  • Trackbacks - 36

 

My experiences with Visual Studio.Net 2005

In Visual Studio.Net 2005 things have changed quite a bit. For better. But for people who resist changes, they're gonna have some starting trouble. Like the following ones. For me. May be for you as well.

Problem 1:
I want to run my webservices under IIS, not on a developement server with some port (For ex: 4187) which kicks off while debugging (when you press F5).

Solution:

  1. Right click on the project (there's no really a project there in your solution explorer. Its just a directory structure like C:\...\MyWebSvc\) click Build site.
  2. Go to windows explorer right click on this directory (MywebSvc) web share it. Go to IIS, Go to the default web site -> MyWebSvc right click properties -> Remove application -> Create application. Say apply. Done.
  3. Now you can run http://localhost/MyWebSvc/Service.asmx and attach this as webreference to your other project (which uses the websvc) so that your other team members can use this websvc which is now setup on your machine. Make sure you change "localhost" to your machine name, when you web reference it in another project.

Ideally this is exactly what might have to be done on a production web server. I am not sure what the publish site does. Need to check it out though.

Problem 2:
As explained in the Solution above, I am not really comfortable with the idea of having a directory structure for WebSvc or ASP.Net website, without a .csproj.
Can someone tell me what's the purpose and how better to get used to it?

Problem 3:
This is not completely related to VS.Net 2005 but still I would like to put it this way. I have a web service running on my machine, which talks to a SQL server db using windows authentication of my machine. When I run this websvc from my machine all goes fine. Now my other team members run this websvc from their machines, the SQL server login fails. Even I run it from my webbrowser (not in debug mode, not through the dummy dev server) it fails.

Solution:
You have to impersonate the aspnet_wp worker process to use your windows authentication, which can be done by adding the following nodes to your web.config of the MyWebSvc.

<authentication mode="Windows" />

<identity impersonate="true" />

Problem 3.1:
Now with the above problem 3 solved, you have one more minor problem, when you run this websvc from IIS, you want to debug it. So you attach aspnet_wp.exe to your project in the visual studio. But just when you open the SQLConnection (SQLConnection.open), throws an exception
[SqlException: EXECUTE permission denied on object 'sp_sdidebug', database
'master', owner 'dbo'.]
But, if you have handled this exception without rethrowing it, rest of the code works fine without a problem.

Solution:
While attaching the aspnet_wp.exe process, just make sure you've changed the "Attach to:" to work on only "Managed code", just uncheck the "T-SQL code".
Now you won't get an exception while debugging. Check out for more info on this problem.


Feedback

# re: My experiences with Visual Studio.Net 2005

Gravatar Hi,

About problem 2, after lots of complains, MS is going to offer a web project template that is like a web project in Visual Studio 2003.

Have a look at the beta: http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx 3/10/2006 3:40 AM | Simon Laroche

# re: My experiences with Visual Studio.Net 2005

Gravatar Hi, man.
About problem 1, 2: Why didn't you just make the folder as a virtual ffolder in IIS and then go to file-> open -> website, and from the side bar in the left of the dialog that appears, select IIS, and open the site from there ?
About problem 3, this is NOT a problem. This is by design. You might have heard that ASP.NET runs with the aspnet account (Windows 2003), or the networkservice (Windows XP, don't remember the exact username!) on the machine, and to make it connect as another account, you need to tell it to impersonnate the user logged in (use its account), which of course requires authentication to be windows.
This has been since ASP.NET 1.x, and not newly presented in /ASP.NET 2.0.
I think the last problem maybe due to some issue with attaching. I totally agree with you that it's not a comfortable way to do debugging. I think you'll get rid of it if you open the site from IIS as I mentioned above.
Regards, 3/10/2006 4:15 AM | Mohamed A. Meligy

# re: My experiences with Visual Studio.Net 2005

Gravatar Thanks for your solution to problem 3.1. Did a lot of searching on it and finally your tip helped me solve my debugging problem. Thanks! 4/19/2006 2:19 PM | Zheng Tan

# re: My experiences with Visual Studio.Net 2005

Gravatar Thanks Zheng. My pleasure.
4/19/2006 2:33 PM | Vin

# re: My experiences with Visual Studio.Net 2005

Gravatar Excellent!!! I've just spent ages searching google (web and groups) for a solution to the sp_sdidebug problem (3.1). I finally found your blog and my problem is solved!!!! THANK YOU!!!!! 5/31/2006 8:00 AM | Andy

# re: My experiences with Visual Studio.Net 2005

Gravatar I'm another person who benefited from your solution to 3.1. Been searching for a while but found nothing useful until now. You saved my day! Thank you!! 7/7/2006 6:11 PM | John Le

# re: My experiences with Visual Studio.Net 2005

Gravatar How do I make my .Net 2005 Web project runs with IIS Server instead of ASP.NET Development Server when trying to run the app from Visual Studio 2005.

Can some explain the behavior of Visual Studio 2005 in terms of running/debugging a Web application. 10/6/2006 9:30 AM | Satish

# re: My experiences with Visual Studio.Net 2005

Gravatar Just like everybody else, your solution to problem 3.1 have saved my day... Thx! 5/21/2007 7:40 AM | Adrian

Post a comment





 

 

 

Copyright © Vinayak