I've wrote a web application that is also listening to a net tcp port.
the client of this web application is connecting via a plain tcp connection and everything is working great but the issue is that the IIS is stopping my site after some inactive time.
The issue is that the web application is initializing the tcp connection and any new connection is coming directly to the TCP connection without being hosted by the site.
I'm not sure how this should be solved.
found exactly the post that nailed it!
https://weblog.west-wind.com/posts/2013/oct/02/use-iis-application-initialization-for-keeping-aspnet-apps-alive
in general it specify that the application pool should be set to always running and the site should host the service at the pre load event that should be configured and implemented.
Related
We have one WCF Service hosted on IIS and there is an WebApp the calls the WCF Service using BasicBinding.
The Service hangs from time to time, I think after a large number of calls.
Sine we host both the WCF Service and the WebApp, is it possible to check if the WebApp closes the connection with the Service.
I am thinking any tool out of the box.
Answering my own question was never my intention. Anyway, I'v fond a very good tool called TCPView.
https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview
I run in on same Server as my WCf Service and could see the list of all open connections.
Best Ragreds
I have a Xamarin app that connects to a SignalR server hosted on Azure.
Since it's Xamarin running over mono, websockets are not available.
When my server was hosted on Azure Mobile Services, the app used SSE.
I moved the server to a web role because mobile services were too limited.
Now my app fails to connect using SSE and falls back to long polling after the 5 seconds timeout interval.
I tried creating a new Web Role and only adding SignalR. Still get the same problem.
I have identified/tried the following:
It looks like the SSE request is being buffered somewhere in Azure. If I use a proxy I can see the request but the first response byte is received only after SignalR times out and closes the connection.
There is no proxy or similar on my network - I can still connect over SSE to my old mobile services server.
I turned on tracing on the server and it looks like SignalR is doing its thing - it returns the response to the SSE connect request.
I can also see the SSE request in IIS in the AuthorizeRequest stage which means the connection is opened.
I disabled dynamic compression. Didn't help.
To summarize, looks like the SSE connection is made, remains open, but something prevents the data from SignalR from reaching the client.
I read here that this can be an issue with the Http Platform Handler. But as far as I understand, this is not relevant to web role since it's normal C# code running in IIS.
Try using HTTPS - it will prevent proxies from messing with the event stream.
I developed a console application that is stored as a web service.
In this console, I host a self-hosted web app service. Also, I open a thread that opens a web socket with another program (HTTP, port 443).... Now, when I initialize the web service, I can reach the self-hosted service, and the web socket works well. Now after 2-3 hours the web socket is closed and this is the exception that i get:
"An established connection was aborted by the software in your host
machine".
Also, I get the following error:
"Exception: Error message: Socket not connected"
..
Has anyone an idea for this?
Have you tried turning your firewall off just to make sure? Also make sure that HttpWebRequest.KeepAlive is turned on
Im looking at this basic chat server/client tutorial using TcpClient in .NET. Now I would like this put the chat server online on my web hosting provider. Is that possible? Can I host this server in IIS somehow? I could probably just start it in Application_Start but I dont think Im allowed to open a connection on any port just like that. What options do I have? I have made a chat app using WCF and net.tcp before but my hosting provider has not activated net.tcp on their IIS-server. So now Im looking at using a TcpClient instead...
I'd avoid attempting to use TCP in shared hosting scenarios. Why not use a HTTP WCF service instead? Most hosts lock down most ports except standard 80/443 and a few others. I can't see that they would allow you to open an arbitrary tcp port from their server, it could be a big security risk.
I would not host a chat in IIS since you are limit to the application pool lifetime. Look after a hosting company that provides virtual servers instead.
I currently have a WCF Service with a CallBack Contract (duplex), and when I use the application that makes use of it on my computer everything works fine, but when I try it from a different computer, it doesn't connect.
These problems started occurring once I switched to using this wsDualHttpBinding (for callbacks) because when I used wsHttpBinding everything worked fine.
Why is the web service not accepting requests from other computers? Is it some hosting settings that need to be modified?
As regards the logs, I am getting these:
alt text http://img17.imageshack.us/img17/4628/wcfissue.jpg
The open operation did not complete
within the allotted timeout of
00:01:00. The time allotted to this
operation may have been a portion of a
longer timeout
Failed to open System.ServiceModel.Channels.ClientReliableDuplexSessionChannel
Faulted
System.ServiceModel.Channels.ClientReliableDuplexSessionChannel
Faulted
System.ServiceModel.Channels.ServiceChannel
Failed to open
System.ServiceModel.Channels.ServiceChannel
The port is open on my router (both TCP and UDP) so that is not the issue.
As regards the Service Attributes, this is what I'm using:
Interface:
[ServiceContract(Name = "MusicRepo_DBAccess_Service",
CallbackContract = typeof(IOnlineUsersCallback),
SessionMode=SessionMode.Required)]
Service:
[ServiceBehavior(
ConcurrencyMode=ConcurrencyMode.Reentrant,
InstanceContextMode=InstanceContextMode.Single)]
[Update]
As regards Orion Edwards' post:
No Firewall
See point 1
Yes I can, because I have the port forwarded on my router
I'm using IIS to host the server.
The thing is, this problem started happening when I switched from wsHttpBinding (which was working fine) to wsDualHttpBinding (because I needed callbacks)
[Update]
I have now switched from wsDualHttpBinding to NetTcpBinding and for some reason, everything is working fine.
I have used this article to help me set up hosting on IIS, and thankully everything is working as expected, with callbacks.
I have now switched from wsDualHttpBinding to NetTcpBinding and for some reason, everything is working fine.
I have used this article to help me set up hosting on IIS, and thankully everything is working as expected, with callbacks.
It would help if you posted the server and client configuration settings.
Here's a summary of how the wsDualHttpBinding works from MSDN (emphasise mine):
The WSDualHttpBinding provides the
same support for Web Service protocols
as the WSHttpBinding, but for use with
duplex contracts. WSDualHttpBinding
only supports SOAP security and
requires reliable messaging. This
binding requires that the client has a
public URI that provides a callback
endpoint for the service. This is
provided by the clientBaseAddress
attribute. A dual binding exposes the
IP address of the client to the
service. The client should use
security to ensure that it only
connects to services it trusts.
This binding can be used to
communicate reliably through one or
more SOAP intermediaries.
By default, this binding generates a
runtime stack with
WS-ReliableMessaging for reliability,
WS-Security for message security and
authentication, HTTP for message
delivery, and a Text/XML message
encoding.
Things to check:
Windows Firewall
Your antivirus product's firewall
Can you telnet into the port from a remote machine?
Is your "server" running under the ASP.NET development server? That will only accept requests from localhosts - you need to self-host the server using ServiceHost or host it under IIS.