Skip to main content

Posts

Showing posts from May, 2010

Configuring mexConnections with net.tcp binding

This is one of the issues that does not explain it self to me and I could not find any help from MSDN, so I thought of sharing in the blog for future use. I have a WCF library that is hosted in IIS, after some time we wanted to increase the max connection property of the service to 100 from the default value of 10 and also change the listenBackLog value to the same (if you dont know what these attributes do, a googling would help :0) The service was configured with 2 endpoints, a net;tcp endpoint and the the other being the meta data exchange endpoint using mexTcpBinding. I also configured a base address, part of the configuration file looks like this : Host it in IIS 7 and the service does not start at all and throws up an error like this : There is no compatible TransportManager found for URI 'net.tcp://ct-svr:8731/AuthorisationManager/Services.Security.AuthorisationManage...

Response.Redirect vs PostBackUrl

I normally use Response.Redirect to navigate from page to page, someone told me the other day that it would be better to use PostBackUrl of a control to redirect to a page then use Response.Redirect. So, I ran a little test of my own, created a 2 sample pages, where on a button click I do a Response.Redirect like this. protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("Advance.aspx"); } Next I ran Fiddler, this is the result I got on the button click, the response I get back from the server is not the content of the page I want but this... HTTP/1.1 302 Found Server: ASP.NET Development Server/10.0.0.0 Date: Mon, 10 May 2010 16:17:57 GMT X-AspNet-Version: 4.0.30319 Location: /Advance.aspx Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 130 Connection: Close Object moved to here . Here; point to the page you want to navigate to (have to live with this HTML formating :)) The server issues a 302 and the browser issues anot...

Passing in parameters into OPENQUERY

I was struggling for some time now, trying to pass in parameters into OPENQUERY, OPENQUERY does not support passing in parameters, all it does it takes a string value as the 2nd parameter like this, SELECT * FROM OPENQUERY(LINKSERVER_NAME, 'SELECT * FROM COUNTRY WHERE COUNTRYID = 10') What's worse, it does not support passing in a varchar variable as the 2nd parameter. So, if you want to pass in parameters, then one of your option is creating a dynamic query and executing it like this declare @var int = 10 declare @query varchar(max) = 'select * from openquery(Test_link,' + '''' + 'SELECT * FROM dbo.TEMP where ID > ' + CAST(@var AS VARCHAR(MAX)) + '''' + ')' execute(@query) IF you want to use the result returned by OPENQUERY, like for an example for joining to another source table, you would have to create a table variable, populate your result and start joining, and illustration would be like this (hypothetical...