SOLVED

Unable to deploy Provider-Hosted Add-Ins in VS - SharePoint Ok?

%3CLINGO-SUB%20id%3D%22lingo-sub-1191435%22%20slang%3D%22en-US%22%3EUnable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1191435%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI've%20now%20tried%20on%20two%20machines.%20When%20I%20try%20to%20debug%2Fdeploy%20Provider-Hosted%20Add-Ins%20in%20Visual%20Studio%2C%20I'm%20getting%20an%20error%20here%3A%20%3A%3C%2FP%3E%3CP%3E2%26gt%3B%20Install%20SharePoint%20Add-in%3A%3CBR%20%2F%3E2%26gt%3B%20Uploading%20the%20SharePoint%20Add-in...%3CBR%20%2F%3E%3CSTRONG%3E2%26gt%3BError%20occurred%20in%20deployment%20step%20'Install%20SharePoint%20Add-in'%3A%20Operation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20tried%20this%20on%20two%20machines%2C%20and%20have%20also%20now%20created%20a%20new%20dev%20site%20and%20tried%20creating%20a%20new%20blank%20Add-In%20in%20Visual%20Studio%2C%20getting%20the%20same%20result.%20Has%20anyone%20else%20seen%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1192452%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1192452%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F566905%22%20target%3D%22_blank%22%3E%40ChuckW960%3C%2FA%3E%26nbsp%3BYou%20can%20download%20demo%20solution%20from%20MS%20and%20check%20if%20you%20can%20deploy%20it%20and%20run%20it.%20It%20may%20help%20you%20to%20track%20down%20what%20is%20your%20specific%20issue.%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FSharePoint_Provider-hosted_Add-ins_Tutorials%2Ftree%2Fmaster%2F1_BeforeSharePointUI%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FOfficeDev%2FSharePoint_Provider-hosted_Add-ins_Tutorials%2Ftree%2Fmaster%2F1_BeforeSharePointUI%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193465%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193465%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F566038%22%20target%3D%22_blank%22%3E%40orchee%3C%2FA%3E%26nbsp%3BThank%20you.%20I%20have%20now%20tried%20that%2C%20and%20am%20getting%20the%20same%20error.%20Is%20it%20possible%20there's%20an%20issue%20with%20my%20tenant%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193492%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193492%22%20slang%3D%22en-US%22%3E%3CP%3E(a%20screenshot%20from%20Visual%20Studio%20when%20I%20try%20to%20deploy)%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ChuckW960_1-1582646676441.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F173449i21E4E5EC034B33F5%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22ChuckW960_1-1582646676441.png%22%20alt%3D%22ChuckW960_1-1582646676441.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193499%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193499%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F566905%22%20target%3D%22_blank%22%3E%40ChuckW960%3C%2FA%3E%26nbsp%3BHave%20you%20configured%20App%20Catalog%20in%20CA%20and%20have%20you%20chosen%20Developer%20Site%20to%20deploy%20in%20VS%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193513%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193513%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F566038%22%20target%3D%22_blank%22%3E%40orchee%3C%2FA%3E%26nbsp%3BThere%20is%20an%20app%20catalog%2C%20yes.%20This%20is%20deploying%20to%20SharePoint%20Online%20btw%2C%20and%20I've%20tried%20a%20few%20different%20developer%20sites.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193520%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193520%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20Fiddler%2C%20I%20see%20a%20request%20to%20(siteurl)%2F_vti_bin%2Fclient.svc%2FProcessQuery%20with%20the%20following%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CREQUEST%20addexpandofieldtypesuffix%3D%22true%22%20schemaversion%3D%2215.0.0.0%22%20libraryversion%3D%2216.0.0.0%22%20applicationname%3D%22.NET%20Library%22%20xmlns%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fsharepoint%2Fclientquery%2F2009%22%3E%0A%20%20%20%20%3CACTIONS%3E%0A%20%20%20%20%20%20%20%20%3COBJECTPATH%20id%3D%2213899%22%20objectpathid%3D%2213898%22%3E%3C%2FOBJECTPATH%3E%0A%20%20%20%20%20%20%20%20%3COBJECTIDENTITYQUERY%20id%3D%2213901%22%20objectpathid%3D%2213898%22%3E%3C%2FOBJECTIDENTITYQUERY%3E%0A%20%20%20%20%20%20%20%20%3CQUERY%20id%3D%2213902%22%20objectpathid%3D%2213898%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CQUERY%20selectallproperties%3D%22true%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CPROPERTIES%3E%3C%2FPROPERTIES%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FQUERY%3E%0A%20%20%20%20%20%20%20%20%3C%2FQUERY%3E%0A%20%20%20%20%3C%2FACTIONS%3E%0A%20%20%20%20%3COBJECTPATHS%3E%0A%20%20%20%20%20%20%20%20%3CMETHOD%20id%3D%2213898%22%20parentid%3D%2213894%22%20name%3D%22LoadApp%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CPARAMETERS%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CPARAMETER%20type%3D%22Binary%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CINCLUDE%20href%3D%22cid%3Ahttp%3A%2F%2Fsharepoint.microsoft.com%2F13900%22%3E%3C%2FINCLUDE%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FPARAMETER%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CPARAMETER%20type%3D%22Int32%22%3E1033%3C%2FPARAMETER%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FPARAMETERS%3E%0A%20%20%20%20%20%20%20%20%3C%2FMETHOD%3E%0A%20%20%20%20%20%20%20%20%3CIDENTITY%20id%3D%2213894%22%20name%3D%2299f2389f-e0fa-9000-c098-a96c435fdfb6%7C740c6a0b-85e2-48a0-a494-e0f1759d4aa7%3Asite%3A7d5d1b43-e14c-4570-bf31-aca9d9a11f6a%3Aweb%3Ae84f8018-aafa-4ea8-b494-42c957e00c6a%22%3E%3C%2FIDENTITY%3E%0A%20%20%20%20%3C%2FOBJECTPATHS%3E%0A%3C%2FREQUEST%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThe%20JSON%20response%20is%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3E%5B%7B%0A%22SchemaVersion%22%3A%2215.0.0.0%22%2C%22LibraryVersion%22%3A%2216.0.19812.12015%22%2C%22ErrorInfo%22%3A%7B%0A%22ErrorMessage%22%3A%22Operation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object.%22%2C%22ErrorValue%22%3Anull%2C%22TraceCorrelationId%22%3A%229af2389f-7002-9000-9ed9-7ab13da9d0cd%22%2C%22ErrorCode%22%3A-1%2C%22ErrorTypeName%22%3A%22System.InvalidOperationException%22%0A%7D%2C%22TraceCorrelationId%22%3A%229af2389f-7002-9000-9ed9-7ab13da9d0cd%22%0A%7D%5D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193538%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193538%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F566905%22%20target%3D%22_blank%22%3E%40ChuckW960%3C%2FA%3E%26nbsp%3Bcheck%20out%20this%26nbsp%3B%3CA%20title%3D%22article%22%20href%3D%22https%3A%2F%2Fwww.sharepointsky.com%2Fprovider-hosted-app-in-sharepoint-online%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Earticle.%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1193747%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1193747%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F566038%22%20target%3D%22_blank%22%3E%40orchee%3C%2FA%3E%26nbsp%3BThanks%20for%20responding%2C%20I've%20already%20done%20the%20walkthroughs%20just%20to%20make%20sure.%20But%20I've%20been%20able%20to%20do%20this%20in%20the%20past.%20Not%20sure%20what's%20changed.%20I've%20asked%20some%20others%20on%20my%20team%20if%20they%20are%20able%20to%20do%20this%2C%20waiting%20to%20hear%20back.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1196532%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20deploy%20Provider-Hosted%20Add-Ins%20in%20VS%20-%20SharePoint%20Ok%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1196532%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20teammate%20let%20me%20know%20she%20was%20able%20to%20do%20this%20last%20night%2C%20and%20today%20when%20I%20tried%20again%20I%20was%20able%20to%20do%20it.%20Would%20love%20to%20know%20what%20%22object%22%20was%20in%20an%20%22invalid%20state%22%20-%20my%20user%20account%2C%20the%20tenant%2C%20the%20site%2C%20the%20code%2C%20my%20machine%2C%20my%20VS%20settings%2C%20etc.%20Oh%20well.%20I%20just%20seem%20to%20have%20been%20in%20some%20sort%20of%20penalty%20box%20for%2048%20hours.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello,

I've now tried on two machines. When I try to debug/deploy Provider-Hosted Add-Ins in Visual Studio, I'm getting an error here: :

2> Install SharePoint Add-in:
2> Uploading the SharePoint Add-in...
2>Error occurred in deployment step 'Install SharePoint Add-in': Operation is not valid due to the current state of the object.

 

I've tried this on two machines, and have also now created a new dev site and tried creating a new blank Add-In in Visual Studio, getting the same result. Has anyone else seen this?

9 Replies

@ChuckW960 You can download demo solution from MS and check if you can deploy it and run it. It may help you to track down what is your specific issue.
https://github.com/OfficeDev/SharePoint_Provider-hosted_Add-ins_Tutorials/tree/master/1_BeforeShareP...

@orchee Thank you. I have now tried that, and am getting the same error. Is it possible there's an issue with my tenant?

(a screenshot from Visual Studio when I try to deploy)

ChuckW960_1-1582646676441.png

 

 

@ChuckW960 Have you configured App Catalog in CA and have you chosen Developer Site to deploy in VS?

@orchee There is an app catalog, yes. This is deploying to SharePoint Online btw, and I've tried a few different developer sites.

In Fiddler, I see a request to (siteurl)/_vti_bin/client.svc/ProcessQuery with the following:

<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0"
    ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
    <Actions>
        <ObjectPath Id="13899" ObjectPathId="13898"/>
        <ObjectIdentityQuery Id="13901" ObjectPathId="13898"/>
        <Query Id="13902" ObjectPathId="13898">
            <Query SelectAllProperties="true">
                <Properties/>
            </Query>
        </Query>
    </Actions>
    <ObjectPaths>
        <Method Id="13898" ParentId="13894" Name="LoadApp">
            <Parameters>
                <Parameter Type="Binary">
                    <Include href="cid:http://sharepoint.microsoft.com/13900"/>
                </Parameter>
                <Parameter Type="Int32">1033</Parameter>
            </Parameters>
        </Method>
        <Identity Id="13894"
            Name="99f2389f-e0fa-9000-c098-a96c435fdfb6|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:7d5d1b43-e14c-4570-bf31-aca9d9a11f6a:web:e84f8018-aafa-4ea8-b494-42c957e00c6a"
        />
    </ObjectPaths>
</Request>

The JSON response is:

[{
"SchemaVersion":"15.0.0.0","LibraryVersion":"16.0.19812.12015","ErrorInfo":{
"ErrorMessage":"Operation is not valid due to the current state of the object.","ErrorValue":null,"TraceCorrelationId":"9af2389f-7002-9000-9ed9-7ab13da9d0cd","ErrorCode":-1,"ErrorTypeName":"System.InvalidOperationException"
},"TraceCorrelationId":"9af2389f-7002-9000-9ed9-7ab13da9d0cd"
}]

 

@orchee Thanks for responding, I've already done the walkthroughs just to make sure. But I've been able to do this in the past. Not sure what's changed. I've asked some others on my team if they are able to do this, waiting to hear back.

best response confirmed by ChuckW960 (Occasional Contributor)
Solution

My teammate let me know she was able to do this last night, and today when I tried again I was able to do it. Would love to know what "object" was in an "invalid state" - my user account, the tenant, the site, the code, my machine, my VS settings, etc. Oh well. I just seem to have been in some sort of penalty box for 48 hours.