LightSwitch v1 shows red X and unable to load data

后端 未结 4 1313
再見小時候
再見小時候 2021-01-14 14:08

I have made an application using Visual Studio LightSwitch 2011 (v1) running on Visual Studio 2010 Professional. It is a desktop application, and I use SQL Server Authentica

相关标签:
4条回答
  • 2021-01-14 14:38

    Thanks to Bryan Hong for pointing me in the right direction. I just want to put my findings in one place for others to refer to if they find themselves in the same situation.

    The following is based off Eric Erhardt's article, which is meant for Lightswitch Web Applications. The steps I list below should apply to Lightswitch Desktop Applications instead.

    Enable tracing in your lightswitch application. To do this, I had to modify the Web.config file located in the release/publish folder (not the file located in the Source folder for your project - LightSwitch will override that web.config -- this was the tricky part). Use a plain text editor to make changes to this: modify the following keys in configuration>>appSettings:

        <!-- A value of true will enable diagnostic logging on the server -->
        <add key="Microsoft.LightSwitch.Trace.Enabled" value="true" />
        <!-- A value of true only lets local access to Trace.axd -->
        <add key="Microsoft.LightSwitch.Trace.LocalOnly" value="false" />
        <!-- The valid values for the trace level are: None, Error, Warning, Information, Verbose -->
        <add key="Microsoft.LightSwitch.Trace.Level" value="Verbose" />
    

    And under configuration>>system.web, make sure trace is enabled:

        <!-- LightSwitch trace.axd handler -->
        <trace enabled="true" localOnly="false" requestLimit="40" writeToDiagnosticsTrace="false" traceMode="SortByTime" mostRecent="true" />
    

    And the last change that you need to make is to set the customErrors mode to Off under configuration>>system.web

    Add the following key (or modify it if it already exists):

        <customErrors mode="Off" />
    

    Now, to view the errors, install Fiddler and then run Fiddler, and the run the silverlight Application. Click on the session on the left, then click on Inspectors, and Web Inspectors on the right. This should show the error message in detail.

    For more information, please refer to Bryan's answer above, or to Eric Erhardt's article.

    0 讨论(0)
  • 2021-01-14 14:43

    It happened to me when I tried to add a reference that didn't have portable support into the common (it came up with a warning when I added it, but I didn't listen at first). If you've done that, uncheck the reference and it should be fine

    0 讨论(0)
  • 2021-01-14 14:52

    Check out Eric Erhardt's article. Here's a quote:

    When your application fails to load data successfully, the screen will display a red X and the tool tip will say “Unable to load data. Please check your network connection and try loading again.”

    A little known secret about LightSwitch is that the server has a Diagnostics subsystem integrated with ASP.NET tracing. LightSwitch’s Diagnostics subsystem is a lot more powerful than just telling you what exception was thrown when issuing a query. You can use it to trace through the actions that were requested of the server, and what steps the server took in response to each action. So even if things seem to be working, you can get more information about what your application was actually doing.

    So you can enable diagnostics then open the trace at: your-lightswitch-application-address/trace.axd. You can then check the error details (screenshot taken from the blog article):

    The error as shown from the trace

    Another alternative way is to use Fiddler. It is also explained in the same article.

    0 讨论(0)
  • 2021-01-14 14:56

    I had same issue after updating my MDF and LDF it's started working. Meaning if you make any changes in database and the entity framework schema is not updated equally than you see this error. it's worked in my case

    0 讨论(0)
提交回复
热议问题