I'm trying to set up a webcam under IIS on an XP platform. I have the code
below
(purloined from Microsoft's website) in my ASP page. All works fine, for
about four or five
page impressions, then the script fails with error '80210006' /webcam.asp,
line 43 (the "Connect")
If I stop (the stop fails, but the service gets marked as stopped) and
restart the WIA service,
the script works again (for about another 4-5 page impressions).

Can anybody tell me what I'm doing wrong here?

Thanks

John

(Email is spamtrapped - remove "ospam" to reply)

<%@ Language=VBScript %>
<!-- 94A0E92D-43C0-494E-AC29-FD45948A5221 -->
<!--METADATA TYPE="TypeLib" UUID="94A0E92D-43C0-494E-AC29-FD45948A5221"-->
<%
Response.Flush ()
Dim oImage
Dim oDeviceManager
Dim oDeviceInfo
Dim oDevice
Dim oItem
Dim oVector

Set oDeviceManager = Server.CreateObject("WIA.DeviceManager")

For Each oDeviceInfo In oDeviceManager.DeviceInfos
If oDeviceInfo.Type = VideoDeviceType Then
Set oDevice = oDeviceInfo.Connect
Exit For
End If
Next

If oDevice Is Nothing Then
Response.Write "There is no Video Device"
Response.End
End If

Set oItem = oDevice.ExecuteCommand(wiaCommandTakePicture)

Set oImage = oItem.Transfer
Set oVector = oImage.FileData

Set oItem = oDevice.ExecuteCommand(wiaCommandDeleteAllItems)

SaveBinaryData "c:\Inetpub\wwwroot\images\Webcam\pic.bmp",
oVector.BinaryData
' Response.BinaryWrite oVector.BinaryData

Set oDeviceInfo = Nothing
Set oDevice = Nothing
Set oDeviceManager = Nothing

Function SaveBinaryData(FileName, ByteArray)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2

'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")

'Specify stream type - we want To save binary data.
BinaryStream.Type = adTypeBinary

'Open the stream And write binary data To the object
BinaryStream.Open
BinaryStream.Write ByteArray

'Save binary data To disk
BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
End Function
%>

Strange WIA Problem by doug

doug
Mon Jan 12 14:51:12 CST 2004

I would say you are probably running into the 10
connections limit for your version of IIS. Upgrade to a
server version of Windows. Desktop versions of Windows
with IIS are limited to 10 connections and each visit to
the webcam page can gobble up more than one connection...

Also, error messages can be helpful for us...

doug
>-----Original Message-----
>I'm trying to set up a webcam under IIS on an XP
platform. I have the code
>below
>(purloined from Microsoft's website) in my ASP page. All
works fine, for
>about four or five
>page impressions, then the script fails with
error '80210006' /webcam.asp,
>line 43 (the "Connect")
>If I stop (the stop fails, but the service gets marked
as stopped) and
>restart the WIA service,
>the script works again (for about another 4-5 page
impressions).
>
>Can anybody tell me what I'm doing wrong here?
>
>Thanks
>
>John
>
>(Email is spamtrapped - remove "ospam" to reply)
>
><%@ Language=VBScript %>
><!-- 94A0E92D-43C0-494E-AC29-FD45948A5221 -->
><!--METADATA TYPE="TypeLib" UUID="94A0E92D-43C0-494E-
AC29-FD45948A5221"-->
><%
> Response.Flush ()
> Dim oImage
> Dim oDeviceManager
> Dim oDeviceInfo
> Dim oDevice
> Dim oItem
> Dim oVector
>
> Set oDeviceManager = Server.CreateObject
("WIA.DeviceManager")
>
> For Each oDeviceInfo In oDeviceManager.DeviceInfos
> If oDeviceInfo.Type = VideoDeviceType Then
> Set oDevice = oDeviceInfo.Connect
> Exit For
> End If
> Next
>
> If oDevice Is Nothing Then
> Response.Write "There is no Video Device"
> Response.End
> End If
>
> Set oItem = oDevice.ExecuteCommand
(wiaCommandTakePicture)
>
> Set oImage = oItem.Transfer
> Set oVector = oImage.FileData
>
> Set oItem = oDevice.ExecuteCommand
(wiaCommandDeleteAllItems)
>
>
SaveBinaryData "c:\Inetpub\wwwroot\images\Webcam\pic.bmp",
>oVector.BinaryData
>' Response.BinaryWrite oVector.BinaryData
>
> Set oDeviceInfo = Nothing
> Set oDevice = Nothing
> Set oDeviceManager = Nothing
>
>Function SaveBinaryData(FileName, ByteArray)
> Const adTypeBinary = 1
> Const adSaveCreateOverWrite = 2
>
> 'Create Stream object
> Dim BinaryStream
> Set BinaryStream = CreateObject("ADODB.Stream")
>
> 'Specify stream type - we want To save binary data.
> BinaryStream.Type = adTypeBinary
>
> 'Open the stream And write binary data To the object
> BinaryStream.Open
> BinaryStream.Write ByteArray
>
> 'Save binary data To disk
> BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
>End Function
>%>
>
>
>.
>

Re: Strange WIA Problem by John

John
Mon Jan 12 15:15:44 CST 2004

Doug,

Thansk for the suggestion, but...

The only error I get is the vbscript error (from the IIS log):

20:22:46 127.0.0.1 GET /webcam.asp |43|80210006|- 500 0

I don't think it's to do with connection limits - the server is processing
the vbscript, so only 1 connection gets made (AFAIK*). It appears
to be a WIA thread not getting freed up (supposition). The question
is, what do I need to do to tidy up after I call the camera?

John

* which is probably not enough

"doug" <anonymous@discussions.microsoft.com> wrote in message
news:05a201c3d94d$d059a170$a301280a@phx.gbl...
> I would say you are probably running into the 10
> connections limit for your version of IIS. Upgrade to a
> server version of Windows. Desktop versions of Windows
> with IIS are limited to 10 connections and each visit to
> the webcam page can gobble up more than one connection...
>
> Also, error messages can be helpful for us...
>
> doug
> >-----Original Message-----
> >I'm trying to set up a webcam under IIS on an XP
> platform. I have the code
> >below
> >(purloined from Microsoft's website) in my ASP page. All
> works fine, for
> >about four or five
> >page impressions, then the script fails with
> error '80210006' /webcam.asp,
> >line 43 (the "Connect")
> >If I stop (the stop fails, but the service gets marked
> as stopped) and
> >restart the WIA service,
> >the script works again (for about another 4-5 page
> impressions).
> >
> >Can anybody tell me what I'm doing wrong here?
> >
> >Thanks
> >
> >John
> >
> >(Email is spamtrapped - remove "ospam" to reply)
> >
> ><%@ Language=VBScript %>
> ><!-- 94A0E92D-43C0-494E-AC29-FD45948A5221 -->
> ><!--METADATA TYPE="TypeLib" UUID="94A0E92D-43C0-494E-
> AC29-FD45948A5221"-->
> ><%
> > Response.Flush ()
> > Dim oImage
> > Dim oDeviceManager
> > Dim oDeviceInfo
> > Dim oDevice
> > Dim oItem
> > Dim oVector
> >
> > Set oDeviceManager = Server.CreateObject
> ("WIA.DeviceManager")
> >
> > For Each oDeviceInfo In oDeviceManager.DeviceInfos
> > If oDeviceInfo.Type = VideoDeviceType Then
> > Set oDevice = oDeviceInfo.Connect
> > Exit For
> > End If
> > Next
> >
> > If oDevice Is Nothing Then
> > Response.Write "There is no Video Device"
> > Response.End
> > End If
> >
> > Set oItem = oDevice.ExecuteCommand
> (wiaCommandTakePicture)
> >
> > Set oImage = oItem.Transfer
> > Set oVector = oImage.FileData
> >
> > Set oItem = oDevice.ExecuteCommand
> (wiaCommandDeleteAllItems)
> >
> >
> SaveBinaryData "c:\Inetpub\wwwroot\images\Webcam\pic.bmp",
> >oVector.BinaryData
> >' Response.BinaryWrite oVector.BinaryData
> >
> > Set oDeviceInfo = Nothing
> > Set oDevice = Nothing
> > Set oDeviceManager = Nothing
> >
> >Function SaveBinaryData(FileName, ByteArray)
> > Const adTypeBinary = 1
> > Const adSaveCreateOverWrite = 2
> >
> > 'Create Stream object
> > Dim BinaryStream
> > Set BinaryStream = CreateObject("ADODB.Stream")
> >
> > 'Specify stream type - we want To save binary data.
> > BinaryStream.Type = adTypeBinary
> >
> > 'Open the stream And write binary data To the object
> > BinaryStream.Open
> > BinaryStream.Write ByteArray
> >
> > 'Save binary data To disk
> > BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
> >End Function
> >%>
> >
> >
> >.
> >



Re: Strange WIA Problem by doug

doug
Tue Jan 13 07:34:31 CST 2004

Is there an error message in the browser or in the event
log? Remember that the original call to the page is one
connection, the spot on the page (image) where the webcam
is is another connection, and any other images on the
page can be more connections. When you say that 4 or 5
connectios are made and then you try to connect another
one and it fails, I would say it's the 10 connection
limit. This happens quite often when trying to run these
types of apps on desktop OS's...

doug
>-----Original Message-----
>Doug,
>
>Thansk for the suggestion, but...
>
>The only error I get is the vbscript error (from the IIS
log):
>
>20:22:46 127.0.0.1 GET /webcam.asp |43|80210006|- 500 0
>
>I don't think it's to do with connection limits - the
server is processing
>the vbscript, so only 1 connection gets made (AFAIK*).
It appears
>to be a WIA thread not getting freed up (supposition).
The question
>is, what do I need to do to tidy up after I call the
camera?
>
>John
>
>* which is probably not enough
>
>"doug" <anonymous@discussions.microsoft.com> wrote in
message
>news:05a201c3d94d$d059a170$a301280a@phx.gbl...
>> I would say you are probably running into the 10
>> connections limit for your version of IIS. Upgrade to a
>> server version of Windows. Desktop versions of Windows
>> with IIS are limited to 10 connections and each visit
to
>> the webcam page can gobble up more than one
connection...
>>
>> Also, error messages can be helpful for us...
>>
>> doug
>> >-----Original Message-----
>> >I'm trying to set up a webcam under IIS on an XP
>> platform. I have the code
>> >below
>> >(purloined from Microsoft's website) in my ASP page.
All
>> works fine, for
>> >about four or five
>> >page impressions, then the script fails with
>> error '80210006' /webcam.asp,
>> >line 43 (the "Connect")
>> >If I stop (the stop fails, but the service gets marked
>> as stopped) and
>> >restart the WIA service,
>> >the script works again (for about another 4-5 page
>> impressions).
>> >
>> >Can anybody tell me what I'm doing wrong here?
>> >
>> >Thanks
>> >
>> >John
>> >
>> >(Email is spamtrapped - remove "ospam" to reply)
>> >
>> ><%@ Language=VBScript %>
>> ><!-- 94A0E92D-43C0-494E-AC29-FD45948A5221 -->
>> ><!--METADATA TYPE="TypeLib" UUID="94A0E92D-43C0-494E-
>> AC29-FD45948A5221"-->
>> ><%
>> > Response.Flush ()
>> > Dim oImage
>> > Dim oDeviceManager
>> > Dim oDeviceInfo
>> > Dim oDevice
>> > Dim oItem
>> > Dim oVector
>> >
>> > Set oDeviceManager = Server.CreateObject
>> ("WIA.DeviceManager")
>> >
>> > For Each oDeviceInfo In oDeviceManager.DeviceInfos
>> > If oDeviceInfo.Type = VideoDeviceType Then
>> > Set oDevice = oDeviceInfo.Connect
>> > Exit For
>> > End If
>> > Next
>> >
>> > If oDevice Is Nothing Then
>> > Response.Write "There is no Video Device"
>> > Response.End
>> > End If
>> >
>> > Set oItem = oDevice.ExecuteCommand
>> (wiaCommandTakePicture)
>> >
>> > Set oImage = oItem.Transfer
>> > Set oVector = oImage.FileData
>> >
>> > Set oItem = oDevice.ExecuteCommand
>> (wiaCommandDeleteAllItems)
>> >
>> >
>>
SaveBinaryData "c:\Inetpub\wwwroot\images\Webcam\pic.bmp",
>> >oVector.BinaryData
>> >' Response.BinaryWrite oVector.BinaryData
>> >
>> > Set oDeviceInfo = Nothing
>> > Set oDevice = Nothing
>> > Set oDeviceManager = Nothing
>> >
>> >Function SaveBinaryData(FileName, ByteArray)
>> > Const adTypeBinary = 1
>> > Const adSaveCreateOverWrite = 2
>> >
>> > 'Create Stream object
>> > Dim BinaryStream
>> > Set BinaryStream = CreateObject("ADODB.Stream")
>> >
>> > 'Specify stream type - we want To save binary data.
>> > BinaryStream.Type = adTypeBinary
>> >
>> > 'Open the stream And write binary data To the object
>> > BinaryStream.Open
>> > BinaryStream.Write ByteArray
>> >
>> > 'Save binary data To disk
>> > BinaryStream.SaveToFile FileName,
adSaveCreateOverWrite
>> >End Function
>> >%>
>> >
>> >
>> >.
>> >
>
>
>.
>

Re: Strange WIA Problem by John

John
Wed Jan 14 01:30:00 CST 2004

Hmmm....Okay. I'll try stripping down the page, and see what happens.
Thanks

"doug" <anonymous@discussions.microsoft.com> wrote in message
news:096801c3d9d9$f9902550$a601280a@phx.gbl...
> Is there an error message in the browser or in the event
> log? Remember that the original call to the page is one
> connection, the spot on the page (image) where the webcam
> is is another connection, and any other images on the
> page can be more connections. When you say that 4 or 5
> connectios are made and then you try to connect another
> one and it fails, I would say it's the 10 connection
> limit. This happens quite often when trying to run these
> types of apps on desktop OS's...
>
> doug
> >-----Original Message-----
> >Doug,
> >
> >Thansk for the suggestion, but...
> >
> >The only error I get is the vbscript error (from the IIS
> log):
> >
> >20:22:46 127.0.0.1 GET /webcam.asp |43|80210006|- 500 0
> >
> >I don't think it's to do with connection limits - the
> server is processing
> >the vbscript, so only 1 connection gets made (AFAIK*).
> It appears
> >to be a WIA thread not getting freed up (supposition).
> The question
> >is, what do I need to do to tidy up after I call the
> camera?
> >
> >John
> >
> >* which is probably not enough
> >
> >"doug" <anonymous@discussions.microsoft.com> wrote in
> message
> >news:05a201c3d94d$d059a170$a301280a@phx.gbl...
> >> I would say you are probably running into the 10
> >> connections limit for your version of IIS. Upgrade to a
> >> server version of Windows. Desktop versions of Windows
> >> with IIS are limited to 10 connections and each visit
> to
> >> the webcam page can gobble up more than one
> connection...
> >>
> >> Also, error messages can be helpful for us...
> >>
> >> doug
> >> >-----Original Message-----
> >> >I'm trying to set up a webcam under IIS on an XP
> >> platform. I have the code
> >> >below
> >> >(purloined from Microsoft's website) in my ASP page.
> All
> >> works fine, for
> >> >about four or five
> >> >page impressions, then the script fails with
> >> error '80210006' /webcam.asp,
> >> >line 43 (the "Connect")
> >> >If I stop (the stop fails, but the service gets marked
> >> as stopped) and
> >> >restart the WIA service,
> >> >the script works again (for about another 4-5 page
> >> impressions).
> >> >
> >> >Can anybody tell me what I'm doing wrong here?
> >> >
> >> >Thanks
> >> >
> >> >John
> >> >
> >> >(Email is spamtrapped - remove "ospam" to reply)
> >> >
> >> ><%@ Language=VBScript %>
> >> ><!-- 94A0E92D-43C0-494E-AC29-FD45948A5221 -->
> >> ><!--METADATA TYPE="TypeLib" UUID="94A0E92D-43C0-494E-
> >> AC29-FD45948A5221"-->
> >> ><%
> >> > Response.Flush ()
> >> > Dim oImage
> >> > Dim oDeviceManager
> >> > Dim oDeviceInfo
> >> > Dim oDevice
> >> > Dim oItem
> >> > Dim oVector
> >> >
> >> > Set oDeviceManager = Server.CreateObject
> >> ("WIA.DeviceManager")
> >> >
> >> > For Each oDeviceInfo In oDeviceManager.DeviceInfos
> >> > If oDeviceInfo.Type = VideoDeviceType Then
> >> > Set oDevice = oDeviceInfo.Connect
> >> > Exit For
> >> > End If
> >> > Next
> >> >
> >> > If oDevice Is Nothing Then
> >> > Response.Write "There is no Video Device"
> >> > Response.End
> >> > End If
> >> >
> >> > Set oItem = oDevice.ExecuteCommand
> >> (wiaCommandTakePicture)
> >> >
> >> > Set oImage = oItem.Transfer
> >> > Set oVector = oImage.FileData
> >> >
> >> > Set oItem = oDevice.ExecuteCommand
> >> (wiaCommandDeleteAllItems)
> >> >
> >> >
> >>
> SaveBinaryData "c:\Inetpub\wwwroot\images\Webcam\pic.bmp",
> >> >oVector.BinaryData
> >> >' Response.BinaryWrite oVector.BinaryData
> >> >
> >> > Set oDeviceInfo = Nothing
> >> > Set oDevice = Nothing
> >> > Set oDeviceManager = Nothing
> >> >
> >> >Function SaveBinaryData(FileName, ByteArray)
> >> > Const adTypeBinary = 1
> >> > Const adSaveCreateOverWrite = 2
> >> >
> >> > 'Create Stream object
> >> > Dim BinaryStream
> >> > Set BinaryStream = CreateObject("ADODB.Stream")
> >> >
> >> > 'Specify stream type - we want To save binary data.
> >> > BinaryStream.Type = adTypeBinary
> >> >
> >> > 'Open the stream And write binary data To the object
> >> > BinaryStream.Open
> >> > BinaryStream.Write ByteArray
> >> >
> >> > 'Save binary data To disk
> >> > BinaryStream.SaveToFile FileName,
> adSaveCreateOverWrite
> >> >End Function
> >> >%>
> >> >
> >> >
> >> >.
> >> >
> >
> >
> >.
> >