I have a WCF application hosted in IIS in which i use WsHttpBinding, with aspnetCompatibility since i want to use RouteTable functionality to route many calls to a single service.
every thing worked as expected, no problems here.
Then i added a tcp endpoint to the service(using its original url), and called the service using client, everything worked here, without a problem.
Then i modified the client url with routed url, and called the method using tcp endpoint, i got a socket error, which is what i expected.
But then i ran the wsHttp client with the routed url (which worked), and ran the tcp client with the routed url (which surprisingly worked)
Are tcp requests and http requests being routed through the same pipeline ?
As far as I know, the System.Web.Routing scenario is only supported for HTTP-based endpoints, since the netTcpBinding really doesn't use URLs in the same way.
--larsw
According to Microsoft's documentation on ServiceRoute, it is only designed to support extension-less base addresses over HTTP transport.
Related
I have developed a simple WCF service (hosted in a Windows Service) quite similar to following msdn article.
http://msdn.microsoft.com/en-us/library/ff647180.aspx#Step1
How should i deploy it so that it can be accessed over internet using tcp?
One thing is that it will use a different port than HTTP (80) and may be blocked by some firewalls (probably most if not all).
TCP binding is used only when the clients are from the same network. If your clients are outside of your network you will have to use HTTP protocol like basicHttpBinding or wsHttpBinding.
In real time application you have multiple service endpoints with different kind of bindings like for backoffice and stand alone application you use netTcpBinding and for internet application you use wsHttpBinding.
I am using wsdualhttpbinding to connect the client and WCF Service. My client likes to invoke a long running request and wanted a periodic status update, hence I have choosen callbackcontracts. that worked fine. However It publishes for all clients who have just been loaded and has not requested that operation.
Is it possible to direct the callbacks to the requestor alone, though all clients are loaded.
I received an answer from this forum. Sharing this.
http://social.msdn.microsoft.com/Forums/en/wcf/thread/c0fce1de-9793-48fa-8e4d-329297ac54d3
I would like to handle HTTP on very low level - at the moment I'm stuck with HTTP CONNECT verb. It looks like HttpListener doesn't have access to these request because they are handled somewhere inside HTTP API or HTTP.SYS. I'm able to handle such requests with native TcpListener but in such case I would lose all HTTP functionality = I would implement HTTP from scratch.
I also checked FiddlerCore but it also handles these requests on some Win API layer. Is there any pure .NET HTTP stack?
Edit: I'm working on HTTP proxy with some additional request analysis and statistics so I don't want to lose HTTP parsing and in the same time I want to know about SSL connections.
Use Tcp* ans Socket*, not Http* related classes to use really low level in .NET.
TCP is at the bottom of HTTP protocol stack.
Use TCP sockets if you want it to, just use "winsock2.dll" interop calls form c#, and all related stuff like structure definitions etc, or use native C++
Well, if you are building your custom HTTP/HTTPS server or proxy and you don't mind third-party components, then our SecureBlackbox includes HTTP/HTTPS server components which let you do almost anything with any verb. Pure .NET, use any socket classes.
Ok. Again the problem is not in API but in developer :)
I have some test suite to test my implementation but the test suite was connecting directly (not as to a proxy) - that was the first problem. The second problem was that this test suite should use TcpClient instead of HttpWebRequest if I want to test Connect verb separately because HttpWebRequest uses it only internally when using proxy for HTTPS.
I am building an application that can receive requests from a website to perform functionality not available in a browser. I accomplished this using a Tcplistener and then call in to it by performing ajax calls with jquery using jsonp. This is fine and works well, the problem now however is that the website also has to be able to use HTTPS, this results in a warning when making ajax calls that are not encrypted which is not desirable.
Is it possible to use https to make calls to my application without having a certificate registered on the users pc, as my application is I guess the server.
I hope that makes sense and I am not being stupid.
Many Thanks
This answer is for C# .NET
For HTTPS calls, the example is provided on MSDN using TCP Listner and TCP Client.
https://learn.microsoft.com/en-us/dotnet/api/system.net.security.sslstream?redirectedfrom=MSDN&view=netframework-4.7.2#Anchor_5
When doing sslStream.AuthenticateAsServer(serverCertificate, ..) you should load a PFX file along with password, instead of CER file, then it will not require registration on client machine.
I have a standard web server that serve web pages.
I want to monitor traffic on port 80, intercept every http responses, and add/inject an additionnal header to them.
The process will then act like a proxy between the web server and the client.
Could you please give me some pointers? I'm already aware of SharpPCap, but I'm not sure where to start.
Note: I can't rely on the web server, I can't control it or change it's configuration. However I can install any other process on the same machine.
Thanks a million
I think that SharpPCap is an overkill here.
Try:
listen on a port (say 8080)
for each incoming connection, accept and open one to the server (original one, port 80)
pass everything that comes in from the client straight to the server
pass everything that comes from the server back to the client, monitoring the stream and injecting/modifying if needed
I think what you want to do can be done with IIS 7.0 URL Rewrite module instead of rolling your own code.
http://learn.iis.net/page.aspx/711/modifying-http-response-headers/