locked
Trying to build a simple LightSwitch app for Sharepoint RRS feed

  • Question

  • SharePoint server is 2013 and is local.

    Using VS 2013 and the Cloud App template for sharepoint.

    Have the AdventureWorks database on an internal server.

    Setup the interface with the database.

    Then just simple try to debug.  For the longest time I was getting access denied because of authentication issues to IIS.

    Temporarily I commented out

    <authorization>

          <deny users="?" />

        </authorization>

    Now I'm getting the following exception:

    Value cannot be null.
    Parameter name: sharePointHostData
                  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.            

    Exception Details: System.ArgumentNullException: Value cannot be null.
    Parameter name: sharePointHostData

    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.                  

    Stack Trace:
    [ArgumentNullException: Value cannot be null.
    Parameter name: sharePointHostData]
       Microsoft.LightSwitch.Framework.Server.SharePointHost..ctor(SharePointAuthDataBase sharePointHostData) +97
       Microsoft.LightSwitch.Framework.Server.SharePointApplication`3.get_SharePoint() +85
       Microsoft.LightSwitch.Framework.Server.SharePointLaunchBase.Page_Load(Object sender, EventArgs e) +163
       System.Web.UI.Control.OnLoad(EventArgs e) +92
       System.Web.UI.Control.LoadRecursive() +54
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

    The app appears to publish to the sharepoint server but I'm just not able to get a screen to come up.  Also, I just have a simple Employee screen created as of now.

    I haven't been able to find much on the latest error.

    Tuesday, May 13, 2014 8:06 PM

All replies

  • Hi kfrosty,

    According to your description above, it throws the error message after you deploy LS application to SharePoint.

    For this issue, we can look into it first. You could follow this tutorial as guide ( http://blogs.msdn.com/b/lightswitch/archive/2013/04/02/sharepoint-hosting-options-for-lightswitch.aspx )

    If you have any concern, please let me know.

    Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 16, 2014 3:19 AM
  • Edit:  Originally posted comments to another non SharePoint problem I was having.  In this case, the SharePoint Certificate properties were not set.

    I've read that article and still having the problems with the sharepoint version.  I'm asking for details on what to troubleshoot or what exactly could cause the sharePointHostData value being null.


    kfrost


    • Proposed as answer by kfrost Friday, May 16, 2014 3:10 PM
    • Edited by kfrost Friday, May 16, 2014 3:21 PM Originally typed info on another issues
    • Unproposed as answer by kfrost Friday, May 16, 2014 3:21 PM
    Friday, May 16, 2014 3:10 PM
  • I've read that article and still having the problems with the sharepoint version.  I'm asking for details on what to troubleshoot or what exactly could cause the sharePointHostData value being null.

    To troubleshoot this issue, you need follow the blog above to configure your SharePoint first.

    Moreover, here are some suggestions for you.

    1. To create an app for SharePoint, you enable the SharePoint features in LightSwitch. 

    Reference: Enable an application for SharePoint

    2. Deploy A LightSwitch Application To Office 365 / SharePoint Online

    hope it helps.



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 20, 2014 8:21 AM
  • Hi, if you are using the vs 2013 with update 2.. From my experience it seems that there are some problems with lightswitch sharepoint solutions.. I had a similar problem with sp online server..

    First of all.. undo every change you did in web.config including the deny users thing..

    After that here's what I did:

    1. Right click on "sharepoint project" in your lightswitch solution -> properties
    2. Open the "SharePoint tab" in those properties
    3. Change the "Target SharePoint Version" from SP2013 to "Sharepoint Online"
    4. Confirm the change.. save all..
    5. At this point vs2013 should ask for reload the solution to be aware of the changes
    6. If it doesn't, click start debugging, it will throw error while building, ignore it.. just wait a few seconds and click start debugging again..
    7. Now it should deploy lightswitch locally and also the sp app to sharepoint..
    8. That worked for debugging on sp online (it might not for sp2013 on premise) but when I tried to publish autohosted and provider hosted apps.. it would deploy but the app was showing the err: "Could not load file or assembly 'Microsoft.SharePoint.Client.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' " 
    9. When I want to publish the app I have to change back the "Target SharePoint Version" to SP2013 even if I install this app to SP Online.. 
    10. Also, the publish never works when I first try to publish the solution.. I have to change to SP online and revert back to SP2013 at least to start working, for every new solution.. 
    Tuesday, May 20, 2014 9:07 AM
  • Thanks Mr. M.

    I'll look into those.  Angie, please stop posting links to blogs.  It just clutters up a thread and is not providing any value.  I've indicated I've read the articles.  Microsoft, please stop throwing admins on these forums that just try to link to other blogs or threads without paying attention to the question being asked.

    Thanks


    kfrost

    Tuesday, May 20, 2014 11:35 AM
  • Thanks Mr. M.

    I'll look into those.  Angie, please stop posting links to blogs.  It just clutters up a thread and is not providing any value.  I've indicated I've read the articles.  Microsoft, please stop throwing admins on these forums that just try to link to other blogs or threads without paying attention to the question being asked.

    Thanks


    kfrost

    Two days ago I received the error you did.

    I updated the article to now handle Provider-hosted (because auto-hosted has been removed as an option by Microsoft for the time being):

    Deploy A LightSwitch Application To Office 365 / SharePoint Online (Provider Hosted)

    Please refrain from person negative statements. There are real people on the other side and it hurts their feelings. Thank you :)

     

    Unleash the Power - Get the LightSwitch HTML Client book

    http://LightSwitchHelpWebsite.com

    Tuesday, May 20, 2014 11:56 AM
  • AD,

    It "hurts my feelings" when somebody from Microsoft just posts links to a question and just starts posting links.  It waste time and clutters up a thread.  Just like me having to now defend asking for it not to be done in the first place.

    I used to work for MS and our department would not tolerate such a thing and I'm going to venture a guess and I'm sure somebody at the correct level still wouldn't.

    Anyway, it's not being negative when you see a problem and try to correct.

    Having said that I'll check out what you're resolution ended up being.

    However to make this a useful thread for the future it would be nice if somebody from MS could chime in and explain what's going on behind the sharepointHost null scenario and some common causes.


    kfrost

    Tuesday, May 20, 2014 12:04 PM
  • ..it would be nice if somebody from MS could chime in and explain what's going on behind the sharepointHost null scenario and some common causes.


    kfrost

    When I tried to connect I got an error that I could not access the page due to not having proper permissions. I looked at the web.config and assumed it was the <deny users="?" /> thing and took it out.

    I then got the exact same error you did and I was very upset! Seriously why does this just not work :)

    Anyway, in my situation it was because I did not set "require https" on one of the pages in the deployment wizard, and https on the web address (in the proper places), and also at one point I tried publishing to a site using only the IP address (that does not work either even if using https). I spent over 4 hours on this with nothing working... grrrrr.

    This is why I wrote the set-by-step tutorial when I got it working :)


    Unleash the Power - Get the LightSwitch HTML Client book

    http://LightSwitchHelpWebsite.com

    Tuesday, May 20, 2014 12:18 PM
  • AD,

    I looked at the article, and first its about deploying an app to sharepoint.  All I'm doing is trying to debug a simple application I started.  Basically it's not much more than using the cloud based template, setting a data model against adventure works.

    Also, AD I still went to the link and did a browser search for sharepointdatahost.  The search didn't turn up anything.

    I'm not trying to deploy a released version.

    So I'm back to somebody on the sharepoint team at Microsoft, can you give us any insight as to why we would get into a situation where sharePointHostData is null.

    My guess is it's some type of authentication problem.  I really don't even need authentication for the application at this point. 

    However, if I turn off Windows Authentication then it makes no difference.


    kfrost


    • Edited by kfrost Tuesday, May 20, 2014 12:21 PM
    Tuesday, May 20, 2014 12:19 PM
  • AD,

    I looked at the article, and first its about deploying an app to sharepoint.  All I'm doing is trying to debug a simple application I started.  Basically it's not much more than using the cloud based template, setting a data model against adventure works.

    Also, AD I still went to the link and did a browser search for sharepointdatahost.  The search didn't turn up anything.

    I'm not trying to deploy a released version.

    So I'm back to somebody on the sharepoint team at Microsoft, can you give us any insight as to why we would get into a situation where sharePointHostData is null.

    My guess is it's some type of authentication problem.  I really don't even need authentication for the application at this point. 

    However, if I turn off Windows Authentication then it makes no difference.


    kfrost


    Lets see if someone from the team answers :)

    I am adding an additional response in case it may help others with this problem...

    I suspect the problem may be on this screen that comes up when you set-up debugging:

    1) Are you pointing to the root of your SharePoint site and using https?

    2) Do you have developer enabled on the SharePoint site? (sorry for pointing to a link but there are a LOT of steps to this process. I just use the online Sharepoint 2013 developer account because it is already set-up for you.

    3) In my experience it is not possible to not have authentication in a SharePoint app.


    Unleash the Power - Get the LightSwitch HTML Client book

    http://LightSwitchHelpWebsite.com

    Tuesday, May 20, 2014 12:31 PM
  • AD,

    First, thank you for your help.

    Answers

    1) The link to my sharepoint server is https://servername/sites/dev

    2) It has the app template setup for development.  I have successfully published a test app using the SharePoint app template.  (I know it's tedious to go through all the steps of setting up a certificate.)  I had a similar problem with the SharePoint provider hosted app but going through all the steps and mucking around with authentication settings it finally started working.

    I've had no such luck with this one.

    3) Good to know but just something I tried.  It just seems odd though that we're talking about permissions on the provider hosted website and not really sharepoint.  SO I could see having to authenticate to the SharePoint site, but if you allow anonymous on your local website which is Lightswitch, it just seems odd that authentication is an issue.

    If nothing else this conversation has at least somewhat confirmed my suspicion that I'm dealing with a cert/authentication issue.   Now I'm hoping there is some type of tracing/logging that will point out exactly what the problem is.

    Thanks again for the responses.


    kfrost

    Tuesday, May 20, 2014 12:40 PM
  • There's a great deal of config to get provider hosted apps to run on- prem. I've not seen any LS specific docs. About the closest is the discussion of ACS vs hightrust in the first link by angie above. I'd assume the SharePoint docs relating to ACS and high trust would apply.
    Wednesday, May 21, 2014 1:19 AM
  • Are there any updates to this?  I am using VS 2013 Update 3 and SharePoint 2013 w/updates applied through 09/2014.  I am getting errors when tring to build/debug a LS Cloud Business App. I am building this on my Development VM (based on Critical Path's v 3.0 VM Build).  I'm getting the folloing error when trying to build/debug:

         value cannot be null.  Parameter Name: sharePointHostData

    Any help would be greatly appreciated.

    

    Cheers, Alan

    Friday, October 24, 2014 12:27 PM
  • Hi kfrosty,

    Did You achieve working LS App deployed on local IIS when this app installed from gallery on SPFarm on-premise? I'm receiving the same error "Value cannot be null. Parameter name: sharePointHostData"  in on-premise configuration. The same app work well both in SharePoint online (with different publish settings of course) and by F5 on http://localhost:43300

    I've read all the MS articles, LS blogs, solved problem of 401.2 error (Negotiate/NTLM->NTLM/Negotiate ), but sharePointHostData=null makes me crazy:) 

    What's the reason of this error???

    Thanks to all who sheds light to this problem.

    Saturday, November 15, 2014 5:40 PM
  • Hello,
    I'm having the same issue when trying to debug a high trust cert LS App after I hit "Trust It" button in SP (Value cannot be null. Parameter name: sharePointHostData). I got SP 2013 on premises and VS 2013 Update 3. I suspect the problem may be with the SP configuration, but have no idea where to look...

    Cheers,

    Jiri


    Wednesday, November 19, 2014 12:50 PM
  • Having the same problem trying to debug when set to on-prem sharepoint 2013. 

    Somebody please?

    Stephen

    Tuesday, December 30, 2014 4:05 AM
  • I got the same exact message: Value cannot be null. Parameter name: sharePointHostData after deploying high-trust LS app in on-prem Sp2013 environment. In my case it was a wrong password for the certificate that the app uses to encrypt its tokens.

    I hope it helps.


    -- Edin http://edinkapic.blogspot.com

    • Proposed as answer by jmanley WI Wednesday, February 18, 2015 7:34 PM
    Thursday, January 15, 2015 2:53 PM
  • Hi

    I have a similar issue. In my case, I created a self-signed cert: I got that working, and went ahead with development, and had the app working both in debug and in deployed mode.

    I then tried to move to a proper/full cert, and got the Value cannot be null.
    Parameter name: sharePointHostData
      error. I tried to move back to the self-signed cert, but that is also now broken with the same issue. I have also tried doing a completely brand new app, and cannot get that to work. Where in SP should I be looking?

    I have done such things as Remove-SPTrustedSecurityTokenIssuer and Remove-SPTrustedSecurityTokenIssuer to pull out the previously setup instances, checked with Get-SPAppPrincipal (and used Register-SPAppPrincipal) to check the app principals, and I just get the same error.

    The self-signed and the full cert seem to have different wording in ULS, but I am currently getting

    SPApplicationAuthenticationModule: Failed to authenticate request, unknown error. Exception details: System.IdentityModel.Tokens.SecurityTokenException: The issuer of the token is not a trusted issuer.   

    at Microsoft.SharePoint.IdentityModel.SPTrustedIssuerNameRegistry`1.GetIssuerName(SecurityToken securityToken, String requestedIssuerName)   

    at Microsoft.SharePoint.IdentityModel.SPJsonWebSecurityBaseTokenHandler.GetIssuerNameFromIssuerToken(JsonWebSecurityToken token)   

    at Microsoft.SharePoint.IdentityModel.SPJsonWebSecurityBaseTokenHandler.GetIssuerName(JsonWebSecurityToken token)   

    at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ValidateTokenCore(SecurityToken token, Boolean isActorToken)   

    at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ValidateTokenCore(SecurityToken token, Boolean isActorToken)   

    at Microsoft.SharePoint.IdentityModel.SPJsonWebSecurityBaseTokenHandler.ValidateToken(SecurityToken token)   

    at Microsoft.SharePoint.IdentityModel.SPJsonWebSecurityTokenHandler.ValidateToken(SecurityToken token)   

    at Microsoft.SharePoint.IdentityModel.SPApplicationAuthenticationModule.TryExtractAndValidateToken(HttpContext httpContext, SPIncomingTokenContext& tokenContext)   

    at Microsoft.SharePoint.IdentityModel.SPApplicationAuthenticationModule.ConstructIClaimsPrincipalAndSetThreadIdentity(HttpApplication httpApplication, HttpContext httpContext, SPFederationAuthenticationModule fam)   

    at Microsoft.SharePoint.IdentityModel.SPApplicationAuthenticationModule.AuthenticateRequest(Object sender, EventArgs e)

    Tuesday, January 20, 2015 4:29 PM