Programmer to ProgrammerTM | |||||
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||||||
The ASPToday
Article June 20, 2001 |
Previous
article - June 19, 2001 |
Next
article - June 21, 2001 | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
ABSTRACT |
| ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Article Discussion | Rate this article | Related Links | Index Entries | ||||||||
ARTICLE |
To take full advantage of this article's information, you will need to have the following installed:
Visual Studio Service Pack 3+ (http://msdn.microsoft.com/vstudio/?WROXEMPTOKEN=1666007ZEWUvaQxPcAmPGMNL5e)
Right now, you may be saying to yourself, "I don't use Front Page, I write my own code thank you." Well, the Extensions were originally developed so Front Page could use web-publishing services to work with IIS, but they now serve as more of an API to Front Page, Interdev, SourceSafe, and IIS.
When you are creating a new project in Interdev, you are using the Server Extensions. When you check out a file from SourceSafe you are as well. In fact, just about any network call you make on a Microsoft Web development platform, you can count on these little guys to do some work.
If you have removed your Extensions correctly, you will now get the error:
Method Not Allowed(Error code = 80070005).
This is because Visual Interdev tries to make a call to the Server Extensions to retrieve the web project information.
Now re-install your Extensions by right-clicking the Default Web Site in your IIS Console and selecting All Tasks - Configure Server Extensions. Use all the defaults and proceed until the window closes.
If you try to create your project in Interdev, you should now have no trouble. By doing this, you are automatically installing the Extensions on your Sub Web. If you know you have a Sub Web in your Default Web, but it does not show up in Interdev, then the Server Extensions will need to be configured on that Sub Web. Do this by right-clicking your project in the left tree pane of the MMC console and selecting Configure Server Extensions. The dialog that follows is pretty basic. In most cases select the default choice, but if you wish, you can skip the mail configuration. This can always be done at a later date (if needed).
Any time you have trouble communicating from Interdev to IIS, you can bet that the Server Extensions (or lack of) are the culprit. For more information on the Front Page Server Extensions, check out these Microsoft Articles:
Configuring Websites with Internet Information Services 5.0
There have been many improvements made to IIS5 from its previous version. It is now fully integrated with the Windows 2000 Operating System, and MTS is built-in. It has also been my experience that IIS5 integrates with our tools much more seamlessly. The debugging features of Interdev will execute quicker and usually prevent unsightly memory dumps as your screen turns blue and your unsaved code goes good-bye.
As stated earlier, when creating a new Sub Web with Interdev, everything you need is automatically set up. This is not always feasible, since you may have a pre-existing project you need to connect with.
Let's create a new Sub Web in IIS, configure it manually, and connect to it with Visual Interdev.
Open your IIS Console again, expand your Default Web, right-click it, and select New - Server Extensions Web. You should now see a window similar to this:
A window will open and prompt you to specify a directory name and a title. Use whatever you like, but it makes sense to call the new web and the directory the same name. Click next and choose Use same administrator as the parent web. Click Next and then Finish. You may have to highlight the Default Web and hit F5 to refresh your pane to see your newly created web.
To configure it we will need to highlight the web we just created, right-click, and select Properties. We will configure this new Sub Web to be an Interdev Project, enable debugging, set its Application Protection, and verify the security settings.
Verify that the account being used is IUSER_MACHINENAME. (Your machines name will be displayed). This is a built-in interactive account on Windows 2000/NT that handles any anonymous HTTP call. Your Sub Web is now set up as an IIS Web Application, and is ready to be opened in Visual Interdev.
Looking at tangled, strangled code for too long can be frustrating. When files point to files that point to files with strange names, and variables aren't pre-fixed with some clue as to what type of data they may have, you need a debugger. The debugger is also an excellent tool to step through code that is not understood, or obvious which statements in conditional logic are being executed.
With Interdev and VB you can step through your code as it executes, check variable values, assign watches to objects and data, and even enter commands from the IDE. You can start debugging an ASP page and as you call a dll method, step right into a Visual Basic class module and continue.
While debugging can be a no-brainer, setting it up can be quite troublesome. It may involve editing your registry and tweaking your application settings.
Open up Interdev, and create a new project called Test. Create your default.asp page, and enter some code, so you can step through in debug mode. For this example, it's best to create a couple of variables and methods to see how the debugger follows the logical code. To see what a variable holds, you can right click it and select Add Watch. Alternatively, just hold your cursor over it for a moment and Intellesense will display the value.
In some cases, Visual Interdev can set up debugging automatically. Hit F5 to begin debugging and see if you can stop on breakpoints. If so, then you don't have to perform the steps below to enable debugging. If you are prompted by a message asking for a start page, select the default page, or the calling page if it can run independently with a new session.
To enable Interdev debugging you must be running Microsoft Personal Web Server 4.0 or Internet Information Server 4.0+. If you are running NT Server then you must additionally check to see if your asp.dll is version 4.02.0662 or later. You can do this by right clicking the file and selecting Properties. Look at the Version tab to see if you have the latest copy. Also, make sure that the file size is 330,448 bytes (NT 4).
You must also have the Visual Interdev Server installed on your web server. This can be found on Disc 2 of Visual Studio, or Disc 1 of the Visual Interdev stand-alone version. Microsoft recommends having the Remote Machine Debugger component installed from your Windows CD.
The last two things to check are your service pack and the latest Front Page Server Extensions version. If you are running Windows 2000 then you will also need Visual Studio Service Pack 3 or later.
Developers will need to be added to the local machine's administrator group to debug. Follow the steps below to verify or configure this step. You will need to be an Administrator on your machine to do this.
Here is where you'll set the rights to use certain services that your machine DCOM server is running. Essentially, all users who will be debugging on the machine need to be added to the Catalog and Machine Debugging Classes.
Now try to hit your breakpoint again, by opening Visual Interdev, selecting the test project we created earlier, opening your default.asp file, left clicking to the left of a line of ASP code, and hitting F5.
If you continue to have trouble after configuring your machine with these settings, there is a wealth of information on this and other Interdev issues at the Microsoft Knowledgebase article here.
Note: If you are debugging to a remote server, it has to have the same operating system as your machine. For more information about debugging manually to a NT or 2000 Server, check out the Microsoft Knowledgebase article noted above.
Here's the Microsoft development environment at it's finest. It's convenient to open up an ASP file, step through the code, and check our data as each step executes, and then create a Visual Basic COM Object and jump right into our business layer.
The component you want to debug must be compiled and registered on the server calling the CreateObject method. To register a non MTS component:
Now open your Visual Basic Project and set a breakpoint in the code. Hit F5. Now open the ASP calling page in Visual InterDev. Set a breakpoint in the calling line. Hit F5. A browser window will not pop up, displaying your page. If you are asked to choose a start page, select the calling page, or the entry point if the page needs to be configured by another.
You should end up with a breakpoint highlighted in Interdev. Click F10 to continue. (Note that this differs between the two development IDE's) When you hit the call or assignment of a COM property or method VB will flash in the task bar. Open your VB window and hit F8 to step through the code. Note that Interdev and VB use different debug keys. Have a look at your options under the Debug menu.
You can add watches and step in and out of methods at will, just as you would in Interdev.
According to the Microsoft Knowledge Base you may receive this error:
Server object, ASP 0178 (0x800A0005) The call to Server.CreateObject failed while checking permissions. Access is denied to this object .
The reason is that the authenticating user, usually the IUSR_MACHINEAME account if you are using anonymous access, does not have the appropriate permissions to access the DCOM Server.
Because there is no DCOM entry for VB6.exe, DCOM uses the default permissions. In Windows 2000, the DCOM Default Access Permissions are only given to the System account and the launching user by default.
To fix this problem, copy the following text into Notepad and save it as ASP_VB_Debug.reg. Run the file and click ok to any prompts. Not that this is case sensitive code. This will give your Visual Basic IDE rights to DCOM.
REGEDIT4 [HKEY_CLASSES_ROOT\CLSID\{70F214BA-94E2-4bdf-8F30-32CB4A905E4D}] @="VB ASP Debugging" [HKEY_CLASSES_ROOT\CLSID\{70F214BA-94E2-4bdf-8F30-32CB4A905E4D}\LocalServer32] @="vb6.exe" [HKEY_CLASSES_ROOT\AppID\vb6.exe] "AppId"="{70F214BA-94E2-4bdf-8F30-32CB4A905E4D}"
For more information on debugging a Visual Basic DLL, look here.
While setting up and running the debuggers in Visual Basic and Interdev is not always painless and straight forward, the time you can save finding little glitches in your application quickly make it worthwhile. Now you can use that time you save doing more important things, like planning proper architecture design, and developing processes to help your shop run a little smoother, but I guess that's another article. I'll get back to you.
|
| |||||||
| |||||||||||||||
|
ASPToday is brought to you by
Wrox Press (http://www.wrox.com/). Please see our terms
and conditions and privacy
policy. ASPToday is optimised for Microsoft Internet Explorer 5 browsers. Please report any website problems to webmaster@asptoday.com. Copyright © 2001 Wrox Press. All Rights Reserved. |