I've implemented pub/sub framework using ASP.NET, WCF Service with net.tcp binding. I hosted wcf service on IIS7.5. My code was developed under VS2010, Windows7.
My demo application is working fine but I just want to handle the error exception when my wcf service callback to client.
So far, my WCF Service or ASP.NET did not throw any error to screen at all.
here is my step of testing:
started service
opened 2 IE (e.g. UserA and UserB)
both User subscribed to WCF Service
closed UserB (closed IE of B)
tried to send msg from UserA to UserB
UserA could send msg to B but no error was appeared
I expected that it should be some error appear to my face but no...
please suggest me how to handle this case?
Thank you
The connection/client lives in IIS on that machine, not your browser. Closing IE will not necessarily close the client instance, meaning the callback will still succeed. If you want to tie the instance to IE, you need to use something like Silverlight to host the callback functionality. Then you should be able to see the behavior you are looking for.
Related
I'm planning to build an application that will include users registration and so on.. I want to build a kind of social network application and i wonder how should I build my server and what is the right way to connect between the application and the server?
I know to build clients and servers in python and connect between them with sockets, but I realise that this is not the right way to do it in mobile applications..
someone told me I should learn something called SOA or web application server , I did not understand him so well,
I hope that you understand what I search for, thanks!
A good start is to create a REST-based backend service that exposes methods/operations via HTTP. Host the service on your server, and allow the app to communicate with the service. This service can send and receive data, typically in the JSON format, between the service and your app(s). Try looking here for some examples:
Python: https://www.sitepoint.com/building-simple-rest-api-mobile-applications/
.NET: https://learn.microsoft.com/en-us/aspnet/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api
How can I validate or lets say "use" a service ticket in a stand alone application? I get that the client in the case of a web application handles teh validation and timeout etc., but what do I have to do that desktop applications do "something" with the service tickets?
Service tickets are provided during the login process webflow. For a standalone application, you should certainly use the REST API: https://apereo.github.io/cas/4.2.x/protocol/REST-Protocol.html
I've followed the guide:
Getting Started with Authentication with Mobile Services .NET for Windows Store
I'm able to run the service locally as long as I don't need to authenticate the user. I can also authenticate the user if I publish the service to Azure. But I want to be able to test and authenticate the user locally. How can this be done?
I'm using Live ID and I have the correct ClientID and ClientSecret set in the Web.config. When I attempt to call LoginAsync from the client the call fails with The request could not be completed. (Method Not Allowed)
** Update 2014-03-20 **
Based on the comments of Carlos and Henrik, I've updated my local service to look exactly like my server instance. I followed Scot Hanselmans excellent guide and now I have my service running locally on port 80 and port 443 with a completely valid SSL certificate. It's even running on the exact same https://xxxx.azure-mabile.net hostname.
With these changes, there is now no configuration difference whatsoever between running the app against my local machine or running it against Azure. I can go to https://xxxx.azure-mabile.net in the browser, get redirected to Live login, sign in, and get redirected back to the service successfully. In the browser it all works. However it still doesn't work in the app.
I attached the debugger, set CLR errors to "break when thrown" and I managed to trap the exception in the service. Here's what I see in the immediate window:
The Response property is not helpful. It does not provide any additional information about the problem.
The only thing that stands out to me is that the app is trying to do a POST to /login/microsoftaccount while the browser would normally be doing a GET at this address (then getting redirected).
** Update #2 2014-03-20 **
After following Henriks guide for remote debugging I was able to load symbols and get a tiny bit more information:
"An existing connection was forcibly closed by the remote host"
The error code is 10054 (WSAECONNRESET) Connection reset by peer.
It appears the Live Authentication server may be forcibly terminating the connection, but only when I'm authenticating with the app. Again, authentication within the browser is fine. This, combined with the fact that /login/microsoftaccount is a POST from the app seems to suggest there is a problem with the authentication token I'm getting back from LiveClient.LoginAsync. I'll do some more digging...
At the moment, it is set up so that you don't need authentication when running locally and access the service from localhost. In this case, anonymous access is let through (this is of course disabled while running in the cloud).
We don't really have a way for your to authenticate locally as redirect URIs won't work (they can't point to localhost as there is not way that Facebook, say, can resolve "localhost").
One option is that we somehow can mock the authentication locally and give you a token without connecting with the various identity providers. I am not sure exactly what that would look like but it is something we can consider.
Henrik
Did you perhaps set Mobile client app: Yes in your Live Connect project? I think that setting is meant to be used with the Live Connect SDK (client) flow, not the browser-based (server) flow. The client flow isn't supported yet with a .NET backend.
You also want to make sure you are using LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount) on the client to trigger the server flow.
I'm trying to test connectivity to couchbase server using the .NET sdk.
I've tried to get a test key in order to do it, but I'm getting "null" (instead of getting an exception mention that couchbase server is done).
I've also read this:
http://www.couchbase.com/docs//couchbase-manual-2.0/couchbase-getting-st...
But it doesn't say anything about testing connectivity from an application code.
Is there any way of testing connection to couchbase server via code ?
The couchbase client sdk manages the connections for you, whatever node urls you pass to it during construction it attempts to authenticate to, if the client can't authenticate to one of the nodes then it throws ConnectException (I'm using the JAVA sdk but I imagine .NET is very similar).
So really you don't have to test the connectivity, the smart client handles that. After construction you can ask the client to list all the available servers
client.getAvailableServers();
Or for a more detailed status of your nodes and statistics do:
client.getStats();
I'm maintaining web server software on which users can deploy web applications. Web applications run as separate processes: the web server launches a web application process, forwards the HTTP request to the web application, and forwards the web application's response back to the HTTP client. The communication between the web server and the web application happens through sockets.
Some users (= web application developers) report that they occasionally get mysterious EIO errors when they write to the socket that connects their web application to the web server (at least, they think it's writing to the socket that causes the error). Some others report that they get this error as well when writing something to STDERR (which is redirected to a log file). Restarting the web server and the web application "fixes" this problem for a short period of time.
What does EIO mean? I know the manual says "Input/output error" but this description is as vague as it can get. Under what circumstances can it occur and how is it different from ECONNREFUSED/EPIPE/ENOTCONN/etc?
Well, apparently EIO can occur when trying to write to a disconnected console device.