<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XML Web Services</title><link>http://forums.asp.net/28.aspx</link><description>All about building XML Web Services with ASP.NET - SOAP, WSDL, WCF, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=66&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: WCF service link to SQL</title><link>http://forums.asp.net/thread/3288831.aspx</link><pubDate>Sun, 12 Jul 2009 23:37:40 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3288831</guid><dc:creator>RickNZ</dc:creator><author>RickNZ</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3288831.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3288831</wfw:commentRss><description>&lt;p&gt;The reasons why it&amp;#39;s not a good idea to have SQL call WCF include things like:&lt;/p&gt;&lt;p&gt;-- Allowing your DB server to call out at all introduces security risks&lt;br /&gt;-- In order for the DB to use WCF, you will have to enable unsafe libraries, which can introduce security and stability problems into the DB&lt;br /&gt;-- It&amp;#39;s architecturally better to have let the DB focus on data-oriented tasks&lt;/p&gt;&lt;p&gt;If it&amp;#39;s important to be able to use the speed of the DB machine, then a Windows Service would be a better way to go.&amp;nbsp; You should be able to put all of the WCF access code in the service, and avoid the requirement to enable anything unsafe in SQL Server.&lt;/p&gt;&lt;p&gt;The way a service would work is that you would have a thread that reads from the Service Broker queue, in a transaction.&amp;nbsp; When a message arrives, the service would process the request -- using WCF or whatever -- and then commit the transaction.&lt;/p&gt;&lt;p&gt;I suggest looking into ASP.NET threading in more detail.&amp;nbsp; It is actually a very powerful model.&amp;nbsp; ASP.NET, and .NET in general, are actually extremely well designed in that area.&lt;/p&gt;&lt;p&gt;In case it might help, I have a detailed example in my book (see my signature) of how to use Service Broker from an ASP.NET background thread, to handle messages that are sent from web pages.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: WCF service link to SQL</title><link>http://forums.asp.net/thread/3280496.aspx</link><pubDate>Wed, 08 Jul 2009 06:32:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3280496</guid><dc:creator>WimVM</dc:creator><author>WimVM</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3280496.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3280496</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry to come back on this topic again. &lt;/p&gt;
&lt;p&gt;While searching for examples and testing things with WCF and SQL I almost always see a very frustrating note in those articles &amp;quot;This is not something you should use in a production environment&amp;quot;. But why not? What is actually the problem with this? Is it not secure? Or not reliable? First it looked like the writer mend that his code needed some fine tuning before being used in production, but more and more I see that (to me)&amp;nbsp;correct implementations have this comment too. The most understandable comment I have seen so far is that MS SQL is not an application server, but a database server. This makes sense.&lt;/p&gt;
&lt;p&gt;Is it the &amp;quot;PERMISSION_SET&amp;quot; for the assembly&amp;nbsp;that needs to be set to unsafe? Or the trustworthy that need to be enabled? Or is CLR stored procedures not the way to go? Or is it just because it is unknown or uncommon technology or method?&lt;/p&gt;
&lt;p&gt;For my project I don&amp;#39;t want to have any direct actions between the web service and the end user who will be using a web based application. The idea was to insert&amp;nbsp;the required action&amp;nbsp;to a table from a webpage that is submitted by an external customer. A trigger linked to this table adds it to the service broker queue (after some&amp;nbsp;security&amp;nbsp;checks)&amp;nbsp;and the service broker launches a script that executes the action to the internally hosted WCF service. This service reports back the result to the service broker and flags the action as success or failed.&lt;/p&gt;
&lt;p&gt;The reasons for not having the user execute it directly are: &lt;br /&gt;- being able to stop processing and delay to a later point in time&lt;br /&gt;- no error message to the end user if an action fails.&lt;br /&gt;- keep a history of the actions&lt;br /&gt;- security: the WCF service is hosted internally in the back end. The end user has only write access to add something in the process table. I want the communication between front and backend limited (firewalled).&lt;br /&gt;- I don&amp;#39;t like threading in ASP.NET. It feels like using something where ASP.NET is not designed for.&lt;br /&gt;- I want to have the load away from the frontend web server and set on the much more perform ant SQL server in the backend.&lt;br /&gt;- Role back the actions&lt;br /&gt;-&amp;nbsp;invoicing is linked to the actions performed by the end user&lt;/p&gt;
&lt;p&gt;I investigated the suggestion by Rick and can implement Windows Services that serves the WCF web service. The only problem is that I don&amp;#39;t see any difference in the implementation in SQL. The database still needs to be set as trustworthy as I have to access an&amp;nbsp;application external to SQL. The only advantage, as Rick point out in his post, is the unsupported .net libraries. I want not able to find a Web services&amp;nbsp;example using a Windows service in SQL. If someone could provide me a basic&amp;nbsp;example&amp;nbsp;it would be very helpful.&lt;/p&gt;
&lt;p&gt;Sorry for the long&amp;nbsp;post. You suggestions and&amp;nbsp;clarifications are much appreciated.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: WCF service link to SQL Service Broker</title><link>http://forums.asp.net/thread/3278160.aspx</link><pubDate>Tue, 07 Jul 2009 06:16:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3278160</guid><dc:creator>WimVM</dc:creator><author>WimVM</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3278160.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3278160</wfw:commentRss><description>Hello Rick,

You&amp;#39;re right. The system.serviceModel.dll is not in the list of supported CLR assemblies: http://msdn.microsoft.com/en-us/library/ms403279.aspx This would require me to register it as an unsafe assembly...

A nice example can be found here: http://nielsb.wordpress.com/sqlclrwcf/</description></item><item><title>Re: WCF service link to SQL Service Broker</title><link>http://forums.asp.net/thread/3275279.aspx</link><pubDate>Sun, 05 Jul 2009 10:37:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275279</guid><dc:creator>RickNZ</dc:creator><author>RickNZ</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275279.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3275279</wfw:commentRss><description>&lt;p&gt;In a hosted environment, you should just start a background thread in your web app, and have it talk to Service Broker.&amp;nbsp; A Windows service is more appropriate for large scale sites that have multiple web servers.&lt;/p&gt;&lt;p&gt;One problem with using SP activation is that your CLR SP will need elevated privileges in order to make a WCF call.&amp;nbsp; Also, SQL CLR doesn&amp;#39;t support 100% of the .NET libraries, so you may find certain classes you need aren&amp;#39;t available there.&amp;nbsp; Doing most of the work in a background thread eliminates those issues.&amp;nbsp; That way, you can let SQL handle the persistent queue side of things, and all of your business logic can be on web tier.&lt;/p&gt;&lt;p&gt;OTOH, if your WCF service is doing something that can be easily expressed in T-SQL instead, then activation might be a better alternative.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: WCF service link to SQL Service Broker</title><link>http://forums.asp.net/thread/3275204.aspx</link><pubDate>Sun, 05 Jul 2009 08:16:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275204</guid><dc:creator>WimVM</dc:creator><author>WimVM</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275204.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3275204</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The reason I was looking to do it with a WCF service was because I have been reading a few days on the subject and I can not find any (working) example in combination with a SQL service broker and a Windows service. Secondly I am still not very confident to expose a Windows service to a solution that will be driven from a (secure) website connected on the internet. I prefer to work in the &amp;quot;safety&amp;quot; of a hosted webservice. I can be wrong in this, it is probably just because I don&amp;#39;t have expierence in deploying&amp;nbsp;Windows services to applications.&lt;/p&gt;
&lt;p&gt;Why is it exactly that a Windows Service is less messy? Could you maybe help me on some basic example (of both Windows service &amp;amp; WCF service)? The calculator example in my first post may be a short and easy&amp;nbsp;candidate for an example? It probably will help a lot of others as I see a lot of open questions on this subject.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;</description></item><item><title>Re: WCF service link to SQL Service Broker</title><link>http://forums.asp.net/thread/3275089.aspx</link><pubDate>Sun, 05 Jul 2009 04:13:56 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275089</guid><dc:creator>RickNZ</dc:creator><author>RickNZ</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275089.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3275089</wfw:commentRss><description>&lt;p&gt;One way would be to use a Windows service to read the Service Broker queue.&amp;nbsp; When a message arrives, the service would process the request.&lt;/p&gt;&lt;p&gt;The alternative is to use activation and SQL CLR, but it gets messy if you want SQL to call out on a WCF service.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>WCF service link to SQL Service Broker</title><link>http://forums.asp.net/thread/3274712.aspx</link><pubDate>Sat, 04 Jul 2009 13:54:44 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274712</guid><dc:creator>WimVM</dc:creator><author>WimVM</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274712.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3274712</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;How do can I let a SQL service broker use a WCF service? To make it pratical, the example found on the MSDN website for the calculator: &lt;a href="http://msdn.microsoft.com/en-us/library/ms733069.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms733069.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I want to add the&amp;nbsp;required values in a SQL table, the service broker should pick it up and then execute it by connecting to a internally hosted example of the calculator here above. I prefer to use the well formed xml method (loaded from the script).&lt;/p&gt;
&lt;p&gt;This is more to understand the concept, I will use it in a project with a different script, but want to understand how it is done.&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;</description></item></channel></rss>