Can't Uninstall Sharepoint Application - Invalid State - sharepoint

Our Sharepoint 2013 Application failed to install and is stuck in a odd state. I followed the recommended approach for deleting the application using powershell commands on the hosted Sharepoint server, but it doesn't execute properly.
Visual Studio Deployment/Retract Reports:
Skipping the uninstall step because the app for SharePoint is in an invalid state and cannot be uninstalled.
PowerShell Commands
$instances = Get-SPAppInstance -Web http://mysite/sites/collection
$instance = $instances | where {$_.Title -eq 'Application.Title'}
Uninstall-SPAppInstance -Identity $instance
Executing this PS command throws...
The System Account cannot perform this action.
There is no option from the Sharepoint UI to remove the application, and retrying the install also fails. I've tried other user accounts to execute this powershell command (other than the system account), but no dice. I will have to delete the developer site collection if there is no other solution.

I'm faced this problem before on my Office 365 SharePoint Online when deploy SharePoint Hosted App. Then I submit Microsoft Service request and work with MS Technical Support Team on this issue. This problem seem to be something error in SharePoint backend database by itself (I'm not sure to consider it is SharePoint defect).
Did you check the app details installation error report? If you get the message:
"The content database on the server is temporarily unavailable."
Need help: Error 'Install App for SharePoint': An instance of this App already exists at the specified location., I'm quite not understand the answer but there is one comment from Jeremy Thake which seem to be deleted on this thread, he said that:
"…so I actually just restarted the whole environment and when Windows
came back up and I went to the SharePoint Site…the App was gone ;-)"
So here is my advice before you commit to delete your site collection:
Try to deploy your to the another developer site collection and check whether this problem still occur as the same.
Try to increase your app version or change app name/title/id and deploy to the same site collection and check whether this problem still occur as the same to your new app instance.
For SharePoint Server, try to restart IIS/Window Server if you're able to do that. Also install any latest SharePoint Update/CU.
For Office365 - SharePoint and have you have license account, you should submit the service request, if not you should wait about several day and try to remove this app instance again through UI.
Hope you can remove your app and know the root cause exactly.

I have faced this issue some times in on-premises SharePoint.
But for solving this I gave another account (or you can use 1 that you have) shell admin rights.
Note this account CAN'T be marked as a System account on SharePoint!!
Then with this different shell admin account you execute the same script. That always worked for me (I also got some strange installation behavior and needed do remove the app).

Related

How do you permanently delete a folder inside an Azure VSTS project?

I have folders within both Azures VSTS (a TFVC repository) and TFS that I needed to permanently delete. On TFS this was quite easily done using the tf destroy $/<MyProject>/<Folder_To_Delete> command in a command window on the server on which the TFS is running. The web page in learn.microsoft.com that describes the "tf destroy" command (Https:// learn.microsoft.com/en-us/vsts/tfvc/destroy-command-team-foundation-version-control) shows that this command is also available for VSTS however I have been unable to get the command to work within a Developer Command Prompt window running on my local box.
tf destroy $/<MyProject>/<Folder_To_Delete> /collection:https://<MyTeamService>.visualstudio.com/<MyProject> /login:<userid>,<password>
The error I receive back is
TF31002: Unable to connect to this Team Foundation Server:
Team Foundation Server Url:
Possible reasons for failure include:
- The name, port number, or protocol for the Team Foundation Server is incorrect.
- The Team Foundation Server is offline.
- The password has expired or is incorrect.
Technical information (for administrator):
The remote server returned an error: (404) Not Found.
However if I put the URL into a browser my VSTS instance shows up. So the 404 looks to me like azure is blocking outside efforts to permanently delete on VSTS. I have logged onto the Azure portal expecting to find something like the Advanced tools option you would find on Web App Services, But the Team Services / Team Projects has nothing like this. Can someone explain to me how to properly execute the "tf destroy" command on Azure Team Services? Or does Azures VSTS just lack the support to permanently delete individual folders and files?
The tf destroy command requires a collection URL. In VSTS, there is no concept of a collection, only team projects. All team projects are created under the Default Collection.
To use the tf destroy command with VSTS, your collection URL must be in the following format:
https://accountname.visualstudio.com/DefaultCollection
By putting a collection URL of https://accountname.visualstudio.com/Project Name, the command was looking for a collection called Project Name in the VSTS account, which does not exist.
This command works:
Open a Developer Command Prompt in administrator mode and issue the following command and supply your credentials.
tf destroy $/Project Name/Folder To Delete /collection:https://accountname.visualstudio.com/DefaultCollection
To Permanently destroy an item/folder in VSTS is also using Destroy Command (Team Foundation Version Control)
tf destroy [/keephistory] <itemspec1>[;<versionspec>][<itemspec2>...<itemspecN>]
[/stopat:<versionspec>] [/preview] [/startcleanup] [/noprompt] [/silent] [/login:username,[password]] [/collection:TeamProjectCollectionUrl]]
/collection which specifies the team project collection. However, in VSTS you only have one collection. There is no collection name like TFS in the url. And multiple collections under user voice:
Let us create multiple collections on Visual Studio Team Services
https://developercommunity.visualstudio.com/idea/365419/let-us-create-multiple-collections-on-visual-studi.html
So, when you specify /collection for VSTS in tf command line, you just need to enter https://xxx.visualstudio.com
Also pay attention to the /login:<userid>,<password>, you are using the wrong format, it should be /login:userid,[password], add a /preview for test first(When tf destroy runs in the preview mode, the files are not actually destroyed.)
Finally the result will be
When you remove the /preview and perform the really destroy, you will also get a prompt info:
Do you want to destroy $/Scrum/NugetTest/Capture1025.PNG and all of
its children? (Yes/No/All)
Select Yes to delete folder and files in it, All with all of its children.
https://<MyTeamService>.visualstudio.com/<MyProject> is the wrong URL. It should just be https://<MyTeamService>.visualstudio.com/.
The parameter is asking for a project collection, not a team project within the collection.

SharePoint 2010 Search - The search request was unable to connect to the Search Service

I am using SharePoint 2010 Foundation and I have a prolem with the search on there. Everytime I search for something I get the response of The search request was unable to connect to the Search Service.
I have spent alot of time looking at this and I cannot seem to see what is causing the issue. The SharePoint Foundation Search service is started but there are no services listed on the server for search other than the 'Help Search'.
Also, if I look into my content databases under the 'Manage Database Upgrade Status' it telling me that the database is too old...
Could anyone point me in the right direction as to how to resolve these issues as it is sending me mad!!
Many Thanks in advance...
Luke
Execute this command in SharePoint 2010 Management Shell (run as administrator)
psconfig -cmd upgrade
It will initiate standard SharePoint Products update and upgrade all databases which are in either "version mismatchm, upgrade is recommended" or "old, upgrade is required" status. The tool runs in command line and gives your updates about installation progress, like this.
PS C:\Users\Administrator> psconfig -cmd upgrade
SharePoint Products Configuration Wizard version 14.0.6009.1000. Copyright (C) M
icrosoft Corporation 2010. All rights reserved.
Performing configuration task 1 of 4
Initializing SharePoint Products upgrade...
Waiting to get a lock to upgrade the farm.
Successfully initialized SharePoint Products upgrade.
Performing configuration task 2 of 4
Initiating the upgrade sequence...
Successfully initiated the upgrade sequence.
Performing configuration task 3 of 4
Upgrading SharePoint Products...
Successfully upgraded SharePoint Products.
Performing configuration task 4 of 4
Finalizing the SharePoint Products configuration...
Successfully completed the SharePoint Products configuration.
Total number of configuration settings run: 4
Total number of successful configuration settings: 4
Total number of unsuccessful configuration settings: 0
Successfully stopped the configuration of SharePoint Products.
Configuration of the SharePoint Products has succeeded.
PS C:\Users\Administrator>
After some further research into this I found it was a simple case of needing to upgrade some of my databases (the search database being one of them).
To view the databases that needed upgrading I used the Powershell Commands:
Get-SPDatabase | ?{$_.NeedsUpgrade -eq $true} | Select Name
AND
Get-SPContentDatabase | ?{$_.NeedsUpgrade -eq $true} | Upgrade-SPContentDatabase
This allowed me to identify all databases that needed this (pretty much the same as using the Health Analyzer in Central Admin). I then ran the following PSCONFIG command through the powershell command windows to perform the upgrade:
psconfig -cmd upgrade -inplace -b2b -force -wait
Finally I ran the Products and Technologies wizard and all worked fine (including the search).
This is my experience:
For every time a fresh new install SharePoint 2010, the search service is good and working. When the 2008 server runs the auto update and found some update patches for SharePoint and get loaded automatically, then the SharePoint search will failed afterward with the message "The search request was unable to connect to the Search Service".
It looks like the auto loaded SharePoint patches will so something inference the search service but not do the work in a clean way.
I have used the "psconfig -cmd upgrade" command first but search is not work at first.
Then, I go to Central Administration -> System Settings -> Manage services on server, stop the "SharePoint Foundation Search" service, this will remove all search index. Start it up again. Afterward, the search works again.

Windows Azure MVC3 app - 500 - Internal server error

I was running my application with no errors locally, but when added Windows Azure project, set up the database config, generated the packages and ran in stage mode, I just can get 500 internal errors.
My app has some redirections for logged and non logged users.
I tried to follow some answers about the problem with no results. When I run the application locally with the emulator everything runs ok.
I didn't set any permission or user anywhere in my SQL or Windows Azure panel. As I don't have any experience with Windows Azure, please explain steps on how to do things =)
Now, after reading almost 20 articles, I realized that I was using the old Membership and Session Providers, and that the old aspnet_regsql doesn't fit Windows Azure.
So, the first action of my application was watch if the user was logged in. Because of that, the 500 Internal errors.
Articles that helped me a lot:
http://geekswithblogs.net/ranganh/archive/2011/06/21/using-the-asp.net-membership-api-wish-sql-server--sql.aspx
http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx

Security Error installing TFS 2010

Yesterday, I was having trouble trying to publish a Visual Studio web app to the wwwroot folder. I could publish it to other folders. The suggested solution to fix the issue was to give the logged on user full rights to the folder. That worked, but I was puzzled because the active user, BESI-CHAD/CHAD, was an Admin user (see image at the bottom of the linked page.)
Now, I am trying to uninstall and re-install TFS and I get the following error suggesting that the user Chad is not in the ServerAdmin role-but I am in that role!
What is going on here?
Error [ Configuration Database ] TF255286: An error occurred while verifying you have the SQL server permission or role membership: serveradmin. You may not even have enough permissions to check. Consider adding your account to the sysadmin server role. The server hosting the databases is BESI-CHAD. The error was: TF30040: The database is not correctly configured. Contact your Team Foundation Server administrator.. See the log for more details.
I ended up using another SQL instance for my TFS db server, an express instance. That worked. I didnt really want another instance. Now, I want to know what happened. If there is a good theory, I might blow away Express and reinstall TFS again.
THis was a while back, but if memory serves, I was an Amdin on the SQL server but did not have rights to the db.

SharePoint Configuration Wizard Weird Behavior?

After you have installed SharePoint you need to run the configuration wizard which typically asks what your Database server is what DB Name to use, what port to use for Central Admin, etc. Then it goes through its 1-9 install process...
Our problem is on one of our servers, which has a clean database, clean 12 hive, and no answer file is to be found (nor should it), the Configuration Wizard goes straight through to the 1-10 install process. It doesn't ask any questions at all...
Why would this occur?
This behavior is expected if your server is already attached to a farm. Was the machine previously part of a SharePoint farm and removed via the farm's Central Admin? Was a clean SharePoint uninstall/reinstall performed?

Resources