application error after deployment but not in development

Soru application error after deployment but not in development

  • 02 Ağustos 2012 Perşembe 13:36
     
     

    Hi

    I posted about this error in the general forum before I realised it was probably better in this one.

    http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/6b2eddff-153a-4cb3-be8e-f88601736e81

    Basically the app runs fine in the dev environment. But when I deploy to the server I get an error when I try to edit a record.

    I cannot see anything in the trace to give me a clue.

    Can anyone suggest how I might debug this error?

    Gus

    ps: I am using VS 2012 RC. The SQL server database objects are identical in local and remote environments.

    I cannot understand what's going wrong.

Tüm Yanıtlar

  • 02 Ağustos 2012 Perşembe 16:25
     
     

    I have a feeling this is a SQL server issue:

    http://connect.microsoft.com/VisualStudio/feedback/details/734196/lightswitch-sql-server-in-use-does-not-support-datatype-datetime2

    My dev box has SQL server 2008 RC2 on it and the target server has SQL server 2012 RC0.

    I have deployed previous versions of this app before without problems. There are no datetime fields anywhere. But there is a VIEW being used

    to populate a drop down.

    I'm going to test deploy to another server with SQL server 2008 on it and see if that works.

    Nothing is ever simple..

  • 02 Ağustos 2012 Perşembe 16:41
     
     

    no, that made no difference..  same error on the other server.

    The frustration for me is that there is nothing meaningful to work with in the trace.

    How can I find out what's going on without an error log?  There is no sign of any error in the trace file. Is there somewhere else I can look?

  • 02 Ağustos 2012 Perşembe 20:13
     
     

    Looked in the SQL server error logs and event viewer on the server. Nothing..

    Can anyone help me resolve this error?

  • 06 Ağustos 2012 Pazartesi 06:34
     
     

    I tried deploying to local IIS and it runs just fine. But when I deploy to our server it breaks.

    All I can think of is that installing VS 2012 beta has installed something on my machine that's not on the server or there is a version of something I have locally that's out of date on the server.

    how can I work out what it is?

    Gus

  • 06 Ağustos 2012 Pazartesi 15:33
     
     

    I think I have narrowed this down a bit.

    Problem is caused by two auto complete controls I have that are bound to SQL VIEWs. If I remove them the update works. They work fine for ADD but when I try to EDIT a record I get the error.

    Gus

  • 07 Ağustos 2012 Salı 20:27
     
     

    I got there in the end. Well, found a workaround.

    I'm not sure if this problem arises because of the way I am trying to do things within the LS model or whether its a bug.

    In short, I have an event which is created in the data workspace initialise event of an add edit screen:

    Using this code I got from another post:

     if (this.co_Consultants_RoleProperty != null)
                {
                    Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(() =>
                    {
                        ((INotifyPropertyChanged)this.co_Consultants_RoleProperty).PropertyChanged += RoleCodePropertyChanged;
                       
                    });
                }

    The event serves the purpose of handling data changes in the screen to enable/disable controls based on user choices. For example, if a user chose "Consultant" in the roles drop down then the "Expertise" control is enabled. If they chose something else then it is disabled.

    Like this:

                        if (this.co_Consultants_RoleProperty.RoleCode == "CO")
                        {
                            this.FindControl("Expertise").IsEnabled = true;
                        }
                        else
                        {
                           this.FindControl("Expertise").IsEnabled = false;
                        }

    But, what I also wanted to do is to clear out the data in the irrelevant fields at the same time. So, I added stuff like:

    this.co_Consultants_RoleProperty.Expertise = null;

    This all worked great on my dev machine, even when I deployed it to IIS.  All ready to deliver with people waiting to test I deployed to the server.

    Bam. Error after error. And NOTHING in the trace. What a frustration.  My app is now at buld 103. Yes. It took me three days to work out what was going on. It ain't easy with NOTHING to go on. And since I had to keep deploying to the server every time i changed something hoping that would be the cause it took forever.

    So, what I have now is only code to disable/enable controls in that event. It works nicely but when a control is greyed out the original value is still visible. Not a show stopper but not very elegant.  Anyone know how to make that happen?

    I have no idea why it works locally and not deployed. Is there something installed on my machine with VS 2012 RC that's missing on the server?

    I have no idea why LS cannot log a useful error when something like this happens. For me it's something that drove me close to ditching LS altogether. I've spent so many hours with it trying to do the most pathetically easy things in other environments. Lightswitch is brilliant and crap at the same time. I love it and hate it in equal measure.

    God help us all..

  • 08 Ağustos 2012 Çarşamba 01:42
    Moderatör
     
     
    In the future, instead of just relying on logging to capture all information about what happened (because it can't always log it, especially if the problem will crash that application), you can just attach the Visual Studio debugger to the deployed application, and debug the problem as if you were debugging the project directly after running from your development machine. If you turned on breaking on all exceptions, you probably would have hit the issue very quickly and noticed why the problem is occurring.

    Justin Anderson, LightSwitch Development Team

  • 08 Ağustos 2012 Çarşamba 06:34
     
     

    that's helpful. I presume that means installing VS on the server, or can I attach remotely?

    Gus

  • 08 Ağustos 2012 Çarşamba 19:30
    Moderatör
     
     

    No need to install VS on production machines.

    If it's an issue in the client that you need to investigate, just navigate to the application from you developer machine and attach the debugger to the running application.

    If it's an issue on the server, you can install the Remote Debugger on the server and attach remotely from your development machine. Here are articles on how to set up the remote debugger and how to use it: http://msdn.microsoft.com/en-us/library/y7f5zaaa(v=vs.100).aspx


    Justin Anderson, LightSwitch Development Team