Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall Microsoft ASP.NET SignalR with no traces

Few days ago when I wanted to use SignalR in the project I installed Microsoft.AspNet.SignalR using Package Manager console.

Install-Package Microsoft.AspNet.SignalR

I found another simpler solution for the problem that does not require SignalR anymore in the project. I uninstalled the package:

Uninstall-Package Microsoft.AspNet.SignalR

After running above command, i did notice package Microsoft.AspNet.SignalR was removed from package.config file.

I assumed whatever changes installation of package was made into project, it would clean automatically with uninstall command.

However, a day after I saw some errors in console log.

WebSocket connection to 'ws://localhost:61135/signalr/reconnect?transport=webSockets&messageId=d-74CFF57F-B%2C0%7CF%2C0%7CD%2C0%7CG%2C1&clientProtocol=1.5&connectionToken=moGkKaoibXu6xg4srnQoGTdxp3axLXQ5h5guoaVYP25MgSKutfN8D%2FyQcJhXamlWjnAhBDIPMjWUEoM9W3%2BP6SQcoQ98jwuiV7lox%2BMNfgyx2x0FOlj6%2BO2PcQ%2Fl3WgwYsbQd7J%2FL1XFVe3yOvNuzw%3D%3D&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=4' failed: Error during WebSocket handshake: Unexpected response code: 502

I felt although I am not initializing the hub in JS anymore the hub initialization code is still running somewhere. I remove StartUp.cs that I added as part of adding SignalR. Ran the application and found this error on browser.

I then investigated what else is still left inside my code base and found SignalR did leave a lot of dependent packages and code files.

Comparing my package.config file, I have below packages result of install command:

    + <package id="Microsoft.AspNet.SignalR.Core" version="2.2.0"
    targetFramework="net45" />
    + <package id="Microsoft.AspNet.SignalR.JS" version="2.2.0"
    targetFramework="net45" />
    + <package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.2.0"
    targetFramework="net45" />
    + <package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
    +  <package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net45" />
    + <package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net45" />

Question 1

Do I have to manually uninstall each one of these packages one by one? Any shortcut?

Question 2

There were js files as well in script folder even after uninstall, i had to manually remove it. Is this really required?

jquery.signalR-2.2.0.js 
jquery.signalR-2.2.0.min.js

Is this the problem with SignalR package or I did something wrong to face this time wastage situation?

like image 853
SBirthare Avatar asked Mar 14 '23 16:03

SBirthare


1 Answers

You need to uninstall package with dependencies to remove dependencies too.

  • use VS UI (Manage Packages in properties of solution or project)
  • add -RemoveDependencies as descibed in NuGet Powershell Reference

    Uninstall-Package Microsoft.AspNet.SignalR -RemoveDependencies
    

(To get out of current state you may want to install package back and than uninstall with dependencies).

like image 164
Alexei Levenkov Avatar answered Mar 24 '23 13:03

Alexei Levenkov