3 Replies - 12104 Views - Last Post: 09 July 2012 - 12:05 AM

#1 astian  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 15-June 12

Problems after deploying a Silverlight Application using WCF service

Posted 06 July 2012 - 03:44 AM

Hi, again Im hoping to be on the right topic. So here it is:
I am publishing a SilverlightApplication that uses a WCF service to read from a database. The application uses Bing Maps to visualize some polygons.
The thing is, that after I publish it ONLY on some machines I get the following Error:

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at ServiceConnection.MyServiceReference.selectAllImotsByEkatte_visualCompletedEventArgs.get_Result()
at Tracing.Views.DrawContent.client123_selectAllImotsByEkatte_visualCompleted(Object sender, selectAllImotsByEkatte_visualCompletedEventArgs e)
at ServiceConnection.MyServiceReference.Service1Client.onselectAllImotsByEkatte_visualCompleted(Object state)
Caused by: [Async_ExceptionOccurred]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft....ceptionOccurred

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at ServiceConnection.MyServiceReference.selectAllImotsByEkatte_visualCompletedEventArgs.get_Result()
at Tracing.Views.DrawContent.client123_selectAllImotsByEkatte_visualCompleted(Object sender, selectAllImotsByEkatte_visualCompletedEventArgs e)
at ServiceConnection.MyServiceReference.Service1Client.onselectAllImotsByEkatte_visualCompleted(Object state)
Caused by: [Async_ExceptionOccurred]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft....ceptionOccurred

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at ServiceConnection.MyServiceReference.selectAllImotsByEkatte_visualCompletedEventArgs.get_Result()
at Tracing.Views.DrawContent.client123_selectAllImotsByEkatte_visualCompleted(Object sender, selectAllImotsByEkatte_visualCompletedEventArgs e)
at ServiceConnection.MyServiceReference.Service1Client.onselectAllImotsByEkatte_visualCompleted(Object state)
Caused by: [Async_ExceptionOccurred]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft....ceptionOccurred

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at ServiceConnection.MyServiceReference.selectAllImotsByEkatte_visualCompletedEventArgs.get_Result()
at Tracing.Views.DrawContent.client123_selectAllImotsByEkatte_visualCompleted(Object sender, selectAllImotsByEkatte_visualCompletedEventArgs e)
at ServiceConnection.MyServiceReference.Service1Client.onselectAllImotsByEkatte_visualCompleted(Object state)

The machines I refer to have different OS. Meaning that on some machines with XP it works fine, on others doesnt, on some machines with winodws 7 it works fine but on others doesnt and etc. , so I believe it is not an OS based problem.
The interesting thing is that I am confident that some of the methods that the application calls from the service work fine, beacause in the beggining of the application you are asked to log in as a user, and the method that validates the user reads from the database and executes on the service, therefore it calls the service successfuly. So some machines have no problem with the login proccess and then they give this error when pressing a button that calls the method mentioned in the eror. Others give the error when trying to log in. (Of course the error that they give in the login fase is with different error message, but the difference is only in the method mentioned in the message. It is again a Async_ExceptionOccurred Debugging resource strings are unavailable... ) So, in some cases I am confident that there have been previous calls to the service that were successful, yet at a certain point it gives that error. I have absolutely no idea how to deal with that and what might be the problem.

In more details how I publish the project.
(I am confident that all my connection strings are correct)
I build the Service in Release mode ( tried in debug too) then I publish it in Filemode. I run it while it is in release mode and in the client I configure the service refence to be on localhost:(servicePort), I do that because the service and the client are on the same machine, then I build the project again tried in both Debug and Release, and publish it in filemode. I then copy the folders on the servermachine. Through IIS7 I create a new site for the service and in the default document I add on the top Service1.svc . I configure the site to open on the same port that the service was run through the studio that I mentioned above, so the service connection configuration in the client to be at the correct port. After that I create a new site for the Client and in the default document I move my default.aspx file on top. The application pools that I use on both projects are ASP.Net v4
So this is everything I can think of, tell me if there is more information that is needed, I am really hoping that I find a way to fix the problem, because it is a deal breaker. I thank you in advance and apologise if I have made some newbie mistakes or didnt explain everything well enough, Im new in programming.

Is This A Good Question/Topic? 0
  • +

Replies To: Problems after deploying a Silverlight Application using WCF service

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5465
  • View blog
  • Posts: 11,740
  • Joined: 02-June 10

Re: Problems after deploying a Silverlight Application using WCF service

Posted 06 July 2012 - 11:19 AM

My first guess would be the version of .NET installed on the PC.
Your key is the first line of the exception

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at ServiceConnection.MyServiceReference.selectAllImotsByEkatte_visualCompletedEventArgs.get_Result()
at Tracing.Views.DrawContent.client123_selectAllImotsByEkatte_visualCompleted(Object sender, selectAllImotsByEkatte_visualCompletedEventArgs e)


You called these two methods in this order:
Tracing.Views.DrawContent.client123_selectAllImotsByEkatte_visualCompleted(Object sender, selectAllImotsByEkatte_visualCompletedEventArgs e)
ServiceConnection.MyServiceReference.selectAllImotsByEkatte_visualCompletedEventArgs.get_Result()


So where do those two methods get called in that order?
Sounds like you need to build in a more robust way: IE Using try/catch blocks and recording failures/exceptions to a log file. Take special note of items 1 and 6 below.


Some of my common tips (some may apply more than others to your specific style):
  • You have to program as if everything breaks, nothing works, the cyberworld is not perfect, the attached hardware is flakey, the network is slow and unreliable, the harddrive is about to fail, every method will return an error and every user will do their best to break your software. Confirm everything. Range check every value. Make no assumptions or presumptions.

  • Take the extra 3 seconds to rename your controls each time you drag them onto a form. The default names of button1, button2... button54 aren't very helpful. If you rename them right away to something like btnOk, btnCancel, btnSend etc. it helps tremendously when you make the methods for them because they are named after the button by the designer.btnSend_Click(object sender, eventargs e) is a lot easier to maintain than button1_click(object sender, eventargs e)

  • You aren't paying for variable names by the byte. So instead of variables names of a, b, c go ahead and use meaningful names like index, timeOut, row, column and so on. You should avoid 'T' for the timer. Amongst other things 'T' is commonly used throughout C# for Type and this will lead to problems. There are naming guidelines you should follow so your code confirms to industry standards. It makes life much easier on everyone around you, including those of us here to help. If you start using the standards from the beginning you don't have to retrain yourself later.
    You might want to look at some of the naming guidelines. Its a lot easier to start with good habits than to break bad habits later and re-learn.



  • Try to avoid having work actually take place in GUI control event handlers. It is better to have the GUI handler call other methods so those methods can be reused and make the code more readable. This is also how you can send parameters rather than use excessive global variables.
    Spoiler


  • Don't replace lines of code that don't work. Instead comment them out and put your new attemps below that. This will keep you from re-trying the same ideas over and over. Also, when you come back to us saying "I've tried this 100 different ways and still can't get it", we can actually see what you tried. So often a failed attempt is very very close and just needs a little nudge in the right direction. So if we can say "See what you did in attempt 3... blah blah" it helps a lot

    Spoiler

    If you are using Visual Studio you can select a block of lines and hit control+k control+c (Kode Comment) to comment it out. control+k control+u (Kode Uncomment) to uncomment a selected block.


  • I strongly suggest installing VMware or some other virtualization technology on your development PC so you can create a couple virtual computers for testing. This would allow you to debug and test inside: WinXP32, XP64, Vista, Win7x32, Win7x64... etc. without having to actually have 5 physical PC's. Visual Studio will let you send the debug directly into one of these virtual machines so you can watch it operate, check its variables, see the crashes and so on just as if it were debugging on your real machine.

This post has been edited by tlhIn`toq: 06 July 2012 - 11:20 AM

Was This Post Helpful? 1
  • +
  • -

#3 astian  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 15-June 12

Re: Problems after deploying a Silverlight Application using WCF service

Posted 08 July 2012 - 11:58 PM

Thanks for the tips, I consider myselft at least trying to use the correct style of programing when refering to variable and method names and etc. And truly see the problems that come when your code is not as readable as possible. I amagine that people write thousands lines of code in some projects, and for me, even with proper naming and formatting of the code I find it difficult to go through not more than 5000 lines of code. I also try to get used to Always using try and catch blocks, and I find myself doing this more and more often. The problem is that in some (lets not say most) of the cases I am not familiar with the exception and how to deal with it. Especialy when it works somewhere (or sometimes) and somewhere it doesnt.
Anyway, about the version of .Net installed, sadly this is not the problem, because I tried deploying the application on a laptop, and in the IIS there was no application pool ASP .Net v4 so I installed what I believe to be the latest version of .Net on the machine. Unfortunately the error appeared once again. The identical situation with a computer running on Windows Server 2008 ...
What I am doing now is trying to get and install tools to help me with diagnosing the problem. I am starting with fiddler, but I have no idea what I am doing, so it may take some time. If you, or anyone, have any suggestions about which tool to use, or on my problem ofcourse, I would appriciate it.
Was This Post Helpful? 0
  • +
  • -

#4 astian  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 15-June 12

Re: Problems after deploying a Silverlight Application using WCF service

Posted 09 July 2012 - 12:05 AM

By the way, I forgot to say , refering to your question "So where do those two methods get called in that order?". The methods are called (in that order) in the reference file that is auto generated when configuring the Service connection. In my code, I am calling the method the following way:
Service1Client client84 = new Service1Client();
                client84.Endpoint.Address = adress;
                client84.selectAllTrainoPolzvane_visualAsync(EKComb);
                client84.selectAllTrainoPolzvane_visualCompleted += new EventHandler<selectAllTrainoPolzvane_visualCompletedEventArgs>(client84_selectAllTrainoPolzvane_visualCompleted);
                client84.CloseAsync();

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1