none
Unable to load data in LS app, but it CAN load the user data - what's gone wrong?

    Question

  • I've finally managed to deploy my first LS app, but am not out of the woods yet. When I run it, I can log in and see the users and roles data fine. I can add users, roles etc.

    However, if I click on any of the screens in the Tasks section of the app (ie the screens I created, as opposed to the admin ones LS adds), then I get a red X in the grid, and a message telling me it can't load the data.

    I have tried connecting to the SQL Server on the server, using the database user's credentials, and it works fine. The fact that it can load the user data confirms this. Any idea why I can't load my own data?

    Thanks


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 3:00 PM

Answers

  • Hi,

    Can you use something like Fiddler to figure out what error you're getting back from the server when you try to run your application?

    A couple of things you can do to figure out what is going on:

    1. Turn on Tracing (http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/45/Tracing-Debugging-Your-LightSwitch-Application-In-Production.aspx)

    2. Set CustomErrors in your web.config to "Off".  Then navigate to one of the endpoints for your application.  You should see these using the tracing functionality above. 

    This should help you see the actual error from the server.  I'm not sure what could be going on that would cause the users/roles to work but not the application data.  Are you using an attached database or did you define it in LightSwitch?

    Thanks!

     

     

    • Marked as answer by Mr Yossu Thursday, July 28, 2011 10:08 PM
    Thursday, July 28, 2011 9:43 PM

All replies

  • I forgot to mention that the app runs absolutely fine in VS, it's the deployed version that doesn't load the data. I also tried loading it on the server machine itself, and had the same problem, confirming again that it's not a network issue.
    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 3:01 PM
  • Also forgot to mention that I tried the app both as an OOB and a web app, but it didn't make any difference.

    Also, following the ideas in this thread, I tried removing the spaces from my application name, but that didn't help.


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 3:16 PM
  • I think you have to check the connectionstring in IIS. Go to the IIS Manager and select your app in tree under Sites/Default Web Site, after that you can select Connectionstring on the right panel. You find a "_IntrinsicData" connection, that is used by LS for Authentication (ASP.NET Tables) and that is the working one i think. Is there another DataSource / Connectionstring?

    In my apps i have a second DataSource/Connectionstring that is used by the app to connect to MY database. But i never used LS to build Tables and so on, I always connect to a exisitng database. I have no idea where are the tables from LS placed...

    Andreas


    Thursday, July 28, 2011 3:28 PM
  • Ah, I think you may be onto something here. I have three connection strings in there, two that the correct user name and password for my app, and one called "LocalSqlServer" that has an SQL Server Express connection string, which references an mdf file in the data directory.

    I was forced to install SQL Server Express when I installed the LS prerequisites, but as you suggested, I stopped the service. It looks like it's trying to connect to SQL Server Express for the data instead of the real database. Maybe that's why it didn't create the tables for me when it installed the app.

    Anyway, I tried changing the connection string in IIS manager so that it's the same as the other two, but it didn't make any difference. I still got the same error.

    Thanks for the reply. Any more ideas?


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 4:25 PM
  • Still in search of a solution...

    I had published the app to a folder in the main web site (which currently consists of nothing more than a single HTML page that says "coming soon"), and noticed that if I clicked on the web site itself in IIS admin, there was a connection string that looked like this...

    data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true

    It was marked "Inherited" in the last column. I removed this, and IIS created a web.config file in the root of the site. This sounds like it's picking up this connection string from somewhere higher up, but I have no idea where. I suspect this might be involved in the problems. Anyway, I removed it, so it should be out of the problem for the moment.

    I then tried removing everything to do with this app, including the database, from the server. I backed up my development database, and restored it on the server. So far so good. I then published a new version of the app, telling it that I would use an existing database, and wanted to specify the admin user.

    I copied this to the server and imported it. This time, I only have two connections strings in the subfolder, one called "_IntrinsicData" and one with the same name as the data source in my LS app. Both of them point to the proper SQL Server.

    Sadly, all of this didn't help. I can still edit the users and roles, but get the same error message for my own data. Like you, I have no idea where the LS tables have gone, as they are not in the same database as my data.

    I would be really grateful if anyone can help me here. I am completely out of ideas. Thanks


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 8:12 PM
  • Ah, just found out that the express connection string is defined in a machine.config file in the %systemroot%\Microsoft.NET\Framework\version\Config\ folder. There's also one in the Framework64 folder. Not sure if this helps, as I removed them from my web site anyway, so they shouldn't have any effect now.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 8:18 PM
  • Hi,

    Can you use something like Fiddler to figure out what error you're getting back from the server when you try to run your application?

    A couple of things you can do to figure out what is going on:

    1. Turn on Tracing (http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/45/Tracing-Debugging-Your-LightSwitch-Application-In-Production.aspx)

    2. Set CustomErrors in your web.config to "Off".  Then navigate to one of the endpoints for your application.  You should see these using the tracing functionality above. 

    This should help you see the actual error from the server.  I'm not sure what could be going on that would cause the users/roles to work but not the application data.  Are you using an attached database or did you define it in LightSwitch?

    Thanks!

     

     

    • Marked as answer by Mr Yossu Thursday, July 28, 2011 10:08 PM
    Thursday, July 28, 2011 9:43 PM
  • Sheel, you're a genius! Tracing was exactly what I needed, it showed me that somehow, the connection string for my actual data, as opposed to the one for the intrinsic data, had the wrong user name, so the log-in failed. I have no idea how this happened, as I specified it quite carefully, but it looks like I must have changed the database user name at some point, and not noticed that the old one was still hanging around.

    That article on debugging helped a lot. Thanks very much.

    In case anyone from Microsoft actually reads this forum, it would be extremely helpful if we could get these sorts of errors reported right through to the UI, instead of having to dig around in the web.config file and examine traces. Would have saved me hours.


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, July 28, 2011 10:08 PM
  • have you got this error after adding Xtrareport extension,then check

    http://community.devexpress.com/forums/t/103278.aspx

    or

    http://www.devexpress.com/Support/Center/p/B187416.aspx

    Saturday, August 06, 2011 10:19 AM
  • have you got this error after adding Xtrareport extension,then check

    http://community.devexpress.com/forums/t/103278.aspx

    or

    http://www.devexpress.com/Support/Center/p/B187416.aspx

    As you can see from the discussion above, it turned out to be an incorrect log-in, which I found by using tracing.

    Thanks anyway.


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Sunday, August 07, 2011 11:43 AM
  • Umm, Sheel *is* from Microsoft, lol.

    Yann

    (plus ça change, plus c'est la même chose!)

    Sunday, August 07, 2011 11:50 AM
    Moderator
  • Umm, Sheel *is* from Microsoft, lol.

    Duh, didn't notice that!

    OK, Sheel, please can you pass on my recommendation that these sorts of errors are propagated up to the client, at least during debug, which would make it a whole lot easier to find out what's going on :)


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Monday, August 08, 2011 10:35 AM
  • The best thing to do is to log a suggestion on the Connect Website, then post a link to it here so we can all vote on it as well.


    Yann

    (plus ça change, plus c'est la même chose!)

    Monday, August 08, 2011 12:44 PM
    Moderator
  • Thanks Yann, but my experience of Connect is that it is a waste of time. I've tried submitting suggestions and bugs there before, and only once ever had any kind of sensible reply (if I got a reply at all), and that was to tell me that the bug I reported was fixed, but the public woudln't see it until the next major version of VS came out. Gee, thanks MS! I submit a bug, which they find and agree to, then I have to wait for years, and spend wads on the next version of VS to get the fix./ It won't even be in a service pack.

    Thanks anyway, but I was rather hoping that some MS people might take more of an interest in this forum and come and see what real user think of the product. Unfortunately, Ms staff seem to be in short supply round here!
    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Monday, August 08, 2011 5:47 PM
  • I don't disagree with you actually, I've not exactly had stellar responses in the past myself, but if we don't at least "go through the motions", then we have no comeback when we're asked "why didn't you tell us about it on Connect"?

    Putting ibugs/suggestions on Connect gets them into the internal system that the team monitor. They can't always be on the forum, unfortunately. We want them busy working on improvements, bug fixes & new features, right? :)

    Beth Massi has promised that the Connect experience *will* improve. Already we now have a "Postponed" status, instead of the "Closed - By Design", or "Closed Won't Fix" statuses that we were told *sometimes* meant that it was "under consideration" for a future version.

    Let's USE the system provided, then TELL them where it's not working, or can be improved. Beth has agreed to take on feedback, & follow-up if required, for posts that don't get the proper attention. Let's take her up on that. If we don't use the system, we can't complain that it's not working.

    The only reason that the team will be "in short supply" is if they're busy working on V2. They're on here whenever they can be (all voluntarily btw).


    Yann

    (plus ça change, plus c'est la même chose!)

    Tuesday, August 09, 2011 12:57 AM
    Moderator
  • Hi Yann,

    Maybe I'm more cynical than you, maybe I've just had more years of Connect submissions being ignored!

    As for support from the LS team, I noticed that Beth Massi was the prominent voice/face before the launch, but I haven't seen her in this forum once since the launch. I am actually very disappointed that someone who was pushing Ls so hard beforehand hasn't made the time to support the very people she's been encouraging. It was inevitable that as soon as it launched, there woudl be a load of people with lots of questions. That happened, and we needed quick support to get us going. Some of the other LS team have been here, but not her. I know their involvement her is voluntary, but for someone as evangelical about LS as she was, I woudl have expected her to make some time to help here.

    Anyway, rant over. I'm actually working on a list of requests for v2, and will post them at some point so others can comment if they feel they woudl be useful or not. That way we can all vote on the requests we most want to see. Hopefully, others will do the same.


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Wednesday, August 10, 2011 3:48 PM