ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Using the .Net DLL (amqmdnet) within Web Service

Post new topic  Reply to topic
 Using the .Net DLL (amqmdnet) within Web Service « View previous topic :: View next topic » 
Author Message
Scooter
PostPosted: Tue Jan 27, 2004 7:04 am    Post subject: Using the .Net DLL (amqmdnet) within Web Service Reply with quote

Apprentice

Joined: 01 May 2003
Posts: 35
Location: Dallas, Tx

We recently updgraded from 5.2 with the .Net support Pack to 5.3 fixpack 5. With the previous version we were using the amqmdnet dll from within a .Net web service (vb.net) with no issues. When I tried to port this Web Service over to the new 5.3 version I get odd errors. The web service appears to work fine on the first hit and sometimes the second and third but always fails on the 4th hit. I get a VB error saying "Object reference not set to an instance of an object". This sounds like a threading issue to me but not sure how to resolve it. Was hoping someone else was doing something similiar that could give me some help.

Thanks.
Back to top
View user's profile Send private message
hamannm
PostPosted: Wed Jan 28, 2004 3:46 am    Post subject: Re: Using the .Net DLL (amqmdnet) within Web Service Reply with quote

Newbie

Joined: 31 Jul 2002
Posts: 3
Location: Germany

Scooter wrote:
I get a VB error saying "Object reference not set to an instance of an object". This sounds like a threading issue to me but not sure how to resolve it. Was hoping someone else was doing something similiar that could give me some help.

Thanks.


Try MQC.MQCNO_HANDLE_SHARE_BLOCK when connecting. This should be the default, but you used old verions.
_________________
Michael Hamann
Back to top
View user's profile Send private message
Scooter
PostPosted: Wed Jan 28, 2004 5:54 am    Post subject: Reply with quote

Apprentice

Joined: 01 May 2003
Posts: 35
Location: Dallas, Tx

Michael,

Thanks for the reply. I tried what you suggested with no success. I'm still getting the error after several invokes of the web service. I have included a simple web service that generates the error after I call it 15 or so times. Hopefully someone can spot something I'm doing wrong.

<WebMethod()> Public Function AddMessage(ByVal strText As String) As String
Dim QMgr As MQQueueManager 'MQSeries Queue Manager
Dim PutQueue As MQQueue 'MQSeries Queue - Input
Dim PutMsg As MQMessage 'MQSeries Message - Input
Dim PutMsgOpt As MQPutMessageOptions 'MQSeries Message Options - Input

Try
PutMsg = New MQMessage
PutMsg.WriteString(strText.Trim)
PutMsg.Format = MQC.MQFMT_STRING
PutMsgOpt = New MQPutMessageOptions
QMgr = New MQQueueManager("QM_mqt1")
'Open MQQueue
'PutQueue = QMgr.AccessQueue("MQT1.LOCAL.TEST", MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQCNO_HANDLE_SHARE_BLOCK)
PutQueue = QMgr.AccessQueue("MQT1.LOCAL.TEST", MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING)
'Put message on the queue
PutQueue.Put(PutMsg, PutMsgOpt)

'Cleanup
PutQueue.Close()
PutQueue = Nothing
PutMsg = Nothing
QMgr.Disconnect()
QMgr.Close()
QMgr = Nothing
AddMessage = "Message was added!"
Catch MQExp As MQException
AddMessage = "MQ Error: " & MQExp.ToString
Catch Exp As Exception
AddMessage = "Error: " & Exp.ToString
End Try

End Function
Back to top
View user's profile Send private message
dunesand
PostPosted: Thu Jan 29, 2004 3:13 am    Post subject: Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

How did you get the MQ running on the server to allow Web Service access permissions?

When I try to create a queue manager it fails with MQRC_NOT_AUTHORISED (2035)...

Your code looks okay. What you could do write a normal windows vb.net app that has a web reference to your web service, then break on the mouse click to step through the code each time to see where it's failing.

later.
Dan.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JasonE
PostPosted: Thu Jan 29, 2004 4:48 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

If you get a 2035, we frequently log an error message in the qmgrs error logs, indicating the userid and the unathorized operation (Windows only).
Back to top
View user's profile Send private message
dunesand
PostPosted: Thu Jan 29, 2004 5:02 am    Post subject: Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

but isn't the IIS thread account executing the code? (or even Anon access)
And so if it doesn't have rights to MQ it'll fail?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JasonE
PostPosted: Thu Jan 29, 2004 5:13 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

Again, depends on releases (OS and MQ) and operating systems.

For example, I have seen IIS threads look like they are running under SYSTEM, ASP.NET, Network Service ID etc.

So the first question is what userid is causing the 2035, the second question is why...
Back to top
View user's profile Send private message
Scooter
PostPosted: Thu Jan 29, 2004 5:42 am    Post subject: Reply with quote

Apprentice

Joined: 01 May 2003
Posts: 35
Location: Dallas, Tx

We configured the IIS web service to run with the IWAM account and then added the IWAM account as a member of the MQM group. This gives the web service access to the QMgr and Queues. Without doing this you get the permission denied error. But that is not been the problem we are seeing. I can hit the web service successfully about 10-15 times and everything works as planned. Then we receive a VB error stating "Object reference not set to an instance of an object". The line that gets this error is somewhat random but are always the lines dealing with the "amqmdnet" componet. Any further hits returns the same error but on the line that creates the MQManager. There is no entries in the event log do to it being a VB error and not a MQ error. We are running MQ5.3 fix pack 5 on a Windows server 2003 with IIS 6.0. We have written the same code into a windows form application and do not see this problem, it appears to be only related to implementation of Web Services. To make thinks worst the previous unsupported version of the component running on MQ 5.2 Windows 2000 environment as a web service has no issues. Been running in that environment for about 4 months. Without this component working we are unable to upgrade our production boxes to 5.3, so any help or suggestions are welcome.
Back to top
View user's profile Send private message
Scooter
PostPosted: Tue Feb 03, 2004 5:30 am    Post subject: Reply with quote

Apprentice

Joined: 01 May 2003
Posts: 35
Location: Dallas, Tx

I have turned this over to IBM Support. I will post resolution once IBM gives me an answer.
Back to top
View user's profile Send private message
Scooter
PostPosted: Mon Feb 09, 2004 12:39 pm    Post subject: Reply with quote

Apprentice

Joined: 01 May 2003
Posts: 35
Location: Dallas, Tx

It turns out it is not a problem with the DLL that was causing our problem but there was a problem with the Trace routines that was making it difficult to use the trace logs to debug the DLL. IBM has a work around patch that fixes the Trace logs when the .Net component is being traced. It turns out that the DLL did not get registered correctly with the GAC and the web service was using a version of the DLL it copied into the BIN folder when it was compiled. Once I removed the copy in the BIN folder and re-registered the DLL with GAC, the problem disappeared.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Using the .Net DLL (amqmdnet) within Web Service
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.