|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Issue - unable to set MQEnvironment.UserID in C# applicaiton |
« View previous topic :: View next topic » |
Author |
Message
|
mqtablet |
Posted: Tue Oct 27, 2009 9:19 am Post subject: Issue - unable to set MQEnvironment.UserID in C# applicaiton |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Hi ,
I'm writing a C# application for my company, when executed has to use the current windows user ID logged in when it has to connect, put/get messages from MQ. However when I use the command
MQEnvironment.UserID = strUsername (strUsername is in user@domain format).
in my application to set the user id, it sets but I get a 2035 at the queue manager level. I mean, it does not allow me to connect to the queue manager itself, though the necessary permissions are in place.
If i run the application with out setting this variable, it just runs fine. I'm able to put/get messages.
Any advice, where am I wrong?
Thanks,
MQTablet |
|
Back to top |
|
 |
Sam Uppu |
Posted: Tue Oct 27, 2009 10:09 am Post subject: |
|
|
 Yatiri
Joined: 11 Nov 2008 Posts: 610
|
2035 - MQRC_NOT_AUTHORIZED
Please check with your MQ Admin on this. The userid whatever you are passing should be authorized at MQ level.
Assuming you are using a serverconn channel in connecting to MQ and looks like the MCAUSER on the SVRCONN channel is empty. If you pass the userid, the authorization will happen at the passing id. If you pass nothing in your code, MQ will pass the userid with which MQ is running on. Say mqm on Unix, MUSR_MQADMIN on windows with which the app has full privileges. |
|
Back to top |
|
 |
mcoyote |
Posted: Tue Oct 27, 2009 11:50 am Post subject: |
|
|
 Newbie
Joined: 27 Oct 2009 Posts: 8
|
I noted the following in the readme for (what appears to be) the current message services for .NET client, which you are probably using:
/*********************************************************************/
/*
/* IBM Message Service Client for .NET
/*
/* FILE NAME: readme.txt
/*
/* DESCRIPTION: Important notes about the product
/*
/*********************************************************************/
...
/************************************************************
*********/
/*
/* Updated: 14th July 2009
/*
/*********************************************************************/
...
6) Known problems
-------------------
...
e) (WMQ) User authentication for WMQ is performed by using the details of the
logged on user and not the information provided in the XMSC.USERID and
XMSC.PASSWORD fields. This is the current design intention for consistency
with WMQ. Please see the WMQ user documentation for further details of
authentication.
...it is therefore conceivable your setting is being ignored. |
|
Back to top |
|
 |
d_wade |
Posted: Fri Oct 22, 2010 7:40 am Post subject: In case your MQ has a UserId and you get MQRC_NOT_AUTHORIZE |
|
|
Newbie
Joined: 21 Oct 2010 Posts: 1
|
I found that in V6 and V7 of the MQ Messaging Library for .NET, the readme file states:
(WMQ) User authentication for WMQ is performed by using the details of the
logged on user and not the information provided in the XMSC.USERID and
XMSC.PASSWORD fields. This is the current design intention for consistency
with WMQ. Please see the WMQ user documentation for further details of
authentication.
I found that if you "impersonate" a windows user at runtime that is the same username of the MQ server before creating the MQQueueManager, it works!
By adjusting this sample code from Microsoft knowledge base article #306158 you can easily accomplish the impersonation.
You can create a local machine user named the same as the MQ userId (i.e. mqm) and impersonate it at runtime, and it will work.
I hope this helps others!
Derek Wade |
|
Back to top |
|
 |
shashikanth_in |
Posted: Sat Oct 23, 2010 5:07 am Post subject: Re: Issue - unable to set MQEnvironment.UserID in C# applica |
|
|
Centurion
Joined: 26 Feb 2009 Posts: 123
|
mqtablet wrote: |
Hi ,
I'm writing a C# application for my company, when executed has to use the current windows user ID logged in when it has to connect, put/get messages from MQ. However when I use the command
MQEnvironment.UserID = strUsername (strUsername is in user@domain format).
in my application to set the user id, it sets but I get a 2035 at the queue manager level. I mean, it does not allow me to connect to the queue manager itself, though the necessary permissions are in place.
If i run the application with out setting this variable, it just runs fine. I'm able to put/get messages.
Any advice, where am I wrong?
Thanks,
MQTablet |
I see you are using MQ .NET classes, not XMS .NET. XMSC.USERID is a property of XMS .NET and as such can't be used in MQ .NET.
The user id that you are passing does not have enough permissions to connect to queue manager. That's why you get 2035. Ask your MQ admin to add the user id to the machine where queue manager is running. Or best is to setup exits to validate user id. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|