Showing posts with label HOWTO. Show all posts
Showing posts with label HOWTO. Show all posts

Wednesday, March 07, 2007

HOWTO - Configure Orphaning on IIS6

Question:

Hi. We are getting an error on the production server: A process serving application pool (pool name) was orphaned, but the specified orphan action (some action) could not be executed.

I remember someone added something to get a memory dump on application hangs there, but the file in (some action) is no longer there. How do I remove the action associated with it?

Answer:

Why, you simply remove that something that someone added which is no longer there, of course... :-P

Joking aside, the relevant metabase properties in your situation are:

How to find all this? Search with key terms like:

OrphanWorkerProcess site:microsoft.com

At this point, you have two basic choices to address the error:

  1. Turn off Orphaning. This stops IIS from orphaning, which also prevents it from running the failing action
  2. Delete the OrphanActionEXE and OrphanActionParams properties. IIS continues to orphan worker processes but stops running the custom action

Personally, I recommend #1 because Orphaning helps debugging when monitored... and hopefully you find the issues in test environments and do not intend to debug production servers

Now, suppose you want to delete the above Orphaning properties. How to find where they are set, what their current values are, and how to delete them? Use your friend ADSUTIL.VBS. For example, the following illustrate sample management of worker process Orphaning.

PUSHD %SYSTEMDRIVE%\Inetpub\Adminscripts

REM Identify all AppPools that set OrphanWorkerProcess
CSCRIPT ADSUTIL.VBS FIND OrphanWorkerProcess

REM Retrieve the value of OrphanWorkerProcess at the global level
CSCRIPT ADSUTIL.VBS GET W3SVC/AppPools/OrphanWorkerProcess

REM Delete the OrphanWorkerProcess property for the DefaultAppPool
CSCRIPT ADSUTIL.VBS DELETE W3SVC/AppPools/DefaultAppPool/OrphanWorkerProcess
POPD

//David

Monday, January 29, 2007

HOWTO: POST Resources to IIS

Question:

i'm working on a piece that requires companies to be able to POST data to one another's web sites using just the URL without page name (i.e. http://doc_uploads.partnetsite.com). there's also no need for any kind of web interface at either end, so i can't expect to grab the data from a form field and save to disk. simply put, using an application like CURL, i should be able to execute a command that says "post myFile.txt to http://doc_uploads.partnersite.com".

i need to figure out how to configure doc_uploads.mysite.com to listen for POST commands and start up an application to capture the POST data and save to disk.

i've seen a few articles on how to use microsoft's posting acceptor to do file uploads, but this requires having the user fill in fields on a page which i can't ask the sender to do.

anybody have any idea how to pull this off? i thought i knew IIS pretty well, but this one has me totally stumped.

Answer:

I can think of a few ways to do what you are asking on IIS, and each has its benefits and drawbacks. In no particular order:

  • Use IIsWebFile to configure a specific URL's Default Document to be the POST acceptor.
  • Use ISAPI Filter to rewrite specific incoming URL without page name to URL with the POST acceptor as the page name
  • Enable and use WebDAV PUT

Whichever is "better" depends on which benefit(s)/drawback(s) you require. The benefits and drawbacks of each approach are as follows, in no particular order.

DefaultDocument/IIsWebFile

This solution is simply IIS configuration of the POST acceptor code. It requires IIS6 on Windows Server 2003, and the POST request URL must end with a backslash to invoke the Default Document without needing 302 courtesy redirection for POST support from the client (i.e. client sends POST to http://doc_uploads.partnetsite.com/).

ISAPI Filter

The ISAPI Filter solution requires writing and maintaining C code for the ISAPI Filter, code for the POST acceptor, and IIS configuration for both the ISAPI Filter and POST acceptor code. It works on any IIS version and there are no requirements on the format of the POST request URL.

WebDAV

WebDAV is purely IIS configuration - no POST acceptor nor C code required. It works on all IIS versions that support WebDAV (pretty much all currently supported IIS versions except the latest IIS7 release, but that should be fixed soon), and the request must look like PUT http://doc_uploads.partnetsite.com/myFile.txt and myFile.txt will be available for retrieval by anyone via GET http://doc_uploads.partnetsite.com/myFile.txt UNLESS you control all applications on IIS from inadvertently serving that resource via some mechanism (NTFS ACLs, IIS Access Permissions, etc).

i.e. once you PUT a file to the web server, it can be retrieved via GET. This is different from a POST acceptor which can be configured to store files outside the URL namespace to avoid inadvertent web-based access of those uploaded resources.

Conclusion

I have only provided the categories of solutions possible - the specific solution for your situation requires more details about your requirements. You do not need to worry about user interactivity, FORM fields, grabbing data, Posting Acceptor, etc - all those tasks can be automated. There are many ways to "post myFile.txt to http://doc_uploads.partnersite.com", and you have only scratched the surface of your requirements...

//David

Thursday, November 02, 2006

HOWTO: Change the ID of an IIS Website

Question:

Hello,

When I install Sharepoint Services, it creates a web site with an identifier. (Ex. ID 4).

I need to change that ID for another one. So I use this command :

cscript adsutil.vbs move w3svc/4 w3svc/4243.

It does the trick...

But, when I look in IIS I see that the site is stopped and I have this error in the event logs:

Event Type:           Error 
Event Source: W3SVC
Event Category: None
Event ID: 1007
Date: 2006-10-25
Time: 13:19:46
User: N/A
Computer: U1U206V
Description:

Cannot register the URL prefix 'http://*:24051/' for site '42'. The
necessary network binding may already be in use. The site has been
deactivated. The data field contains the error number.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Data:
0000: b7 00 07 80 ·..€

If I start the site manually, the site starts fine with no errors.

I just want to know if there's a way to not receive this error message when I change the ID of my site.

Can someone confirm that?

Or is there another way to do it to prevent errors?

Thx in advance for your help.

Answer:

The reason you get that error event when you MOVE a running website is due to how ADSUTIL.VBS MOVE works. You can treat the MOVE operation as a non-atomic COPY-then-DELETE... because it is designed to move arbitrary metabase nodes (for example, one vdir to another vdir in a different tree hierarchy).

Thus, when you use it to move from website ID 4 to website ID 42, what happens is this:

  1. The entire metabase node under website ID 4 is copied to website node with ID 42
  2. Since website ID 4 is running and website node with ID 42 is a website, website ID 42 also attempts to run
  3. However, since both website nodes are duplicates and have the exact same bindings, the new website ID 42 cannot start due to duplicate bindings and trigger the error event
  4. After website ID 42 finishes copying, node ID 4 is deleted
  5. But website ID 42 has already failed to start; there is no state change here

The key is to STOP the source website ID prior to executing the MOVE. In that case, there will be no duplicate bindings simultaneously running during the COPY-the-DELETE, and one will not see the error event.


CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs STOP_SERVER W3SVC/4
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs MOVE W3SVC/4 W3SVC/42
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs START_SERVER W3SVC/42

//David