Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
beyonder422
Posting Yak Master
124 Posts |
Posted - 2009-04-27 : 11:10:24
|
I am trying to send an xml message via MSMQ from a stored procedure and believe the error I am stuck on is security based.I am passing an XmlDocument\string\etc to a Message and am receiving errors.First I resolved this: http://kbalertz.com/913668/Error-message-common-language-runtime-object-Server-dynamically-generated-serialization.aspx, only to start seeing this: http://www.kodyaz.com/blogs/software_development_blog/archive/2006/10/15/455.aspx and can't seem to get past the "assembly does not allow ..." issue.This method works via web page, but this has to be a SQL Server 2005 security issue, because that is the only place it is failing.I have been looking everywhere and have tried at least 20 different iterations.I created (sgen) the serialized version, my assembly is strong named, the XmlSerializer is strong named, the assembly property AllowPartiallyTrustedCallers is set.My db is set trustworthy onassemblies Permission set: Safe - primary and XmlSerializerWhat else can I do, how else can I gather more info to help me troubleshoot? -----------------------------------------------------------------Sample code trying to send xml message to MSMQ from stored procedure:public static void Send(SqlString queue, SqlString msg){XmlDocument _xmlDoc;XmlNode _xmlNode;XmlElement _xmlElement1;XmlElement _xmlElement2;XmlText _xmlText;_xmlDoc = new XmlDocument();_xmlNode = _xmlDoc.CreateNode(XmlNodeType.XmlDeclaration, "", "");_xmlDoc.AppendChild(_xmlNode);_xmlElement1 = _xmlDoc.CreateElement("", "ROOT", "");_xmlText = _xmlDoc.CreateTextNode("");_xmlElement1.AppendChild(_xmlText);_xmlDoc.AppendChild(_xmlElement1);_xmlElement2 = _xmlDoc.CreateElement("", "PLCID", "");_xmlText = _xmlDoc.CreateTextNode("1");_xmlElement2.AppendChild(_xmlText);_xmlDoc.ChildNodes.Item(1).AppendChild(_xmlElement2);using (MessageQueue msgQueue = new MessageQueue(queue.ToString(), QueueAccessMode.Send)){//// version1msgQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });msgQueue.Send(msg.Value);//// version1.1//msgQueue.Formatter = new XmlMessageFormatter(new System.Type[] { typeof(XmlDocument) });//msgQueue.Send(_xmlDoc);//version2//XmlNode node = _xmlDoc;//XmlSerializer XS = new XmlSerializer(typeof(XmlNode));//MemoryStream MS = new MemoryStream();//XS.Serialize(MS, node);//string str = System.Text.Encoding.ASCII.GetString(MS.GetBuffer());//string label = string.Format("Sent at {0}", DateTime.Now);//msgQueue.Send(str, label);}}------------------------------------------------------------------------------Sample database code:alter database test set trustworthy oncreate assembly Messagingauthorization dbofrom 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll'with permission_set = unsafegocreate assembly [nsSqlMsmq] from 'C:\temp\nsSqlMsmq.dll'create assembly [nsSqlMsmq.XmlSerializers.dll] from 'C:\temp\nsSqlMsmq.XmlSerializers.dll'-- Create procedurescreate PROCEDURE uspMSMQSend@queue nvarchar(200),@msg nvarchar(MAX)AS EXTERNAL NAME nsSqlMsmq.[nsSqlMsmq.clsSqlMsmq].SendGO--EXEC uspMSMQSend 'server-name\private$\queuename', '<value>1</value>'---------------------I do not define what is obvious... |
|
beyonder422
Posting Yak Master
124 Posts |
Posted - 2009-04-29 : 10:44:24
|
Still no input? I have posted this issue to more than 5 boards. Are you guys telling me no one has seen this or has an answer for it?---------------------I do not define what is obvious... |
 |
|
|
|
|
|
|