Unable to Download nuGet Package 'System.Runtime.CompilerServices.Unsafe.6.0.0' - c#

New work laptop, new installs of both Visual Studio 2019 and 2022. My team work on a mix of projects, mostly in VS2019, but we have a new project this year that's being written in 2022. I have full admin rights on my laptop, and open both versions of VS with as an administrator.
I downloaded a clean copy of the VS2022 solution from source control to my new laptop (containing several project types, api, web, domain etc.) aimed at creating an Azure web application, but noticed out of the nine projects, two had issues with the dependencies:
As this was a new laptop, using package manager in VS, I tried update one or more packages. I runs through checking each project/package until it reaches one of the projects that has the issue, then breaks with the following error:
Restored
C:\TFS_Workspaces\SDRnD\Main\Source\Tests\SDRnD.Application.Tests\SDRnD.Application.Tests.csproj
(in 144 ms). Failed to download package
'System.Runtime.CompilerServices.Unsafe.6.0.0' from
'https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/6.0.0/system.runtime.compilerservices.unsafe.6.0.0.nupkg'.
Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host. An existing
connection was forcibly closed by the remote host Failed to
download package 'System.Runtime.CompilerServices.Unsafe.6.0.0' from
'https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/6.0.0/system.runtime.compilerservices.unsafe.6.0.0.nupkg'.
Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host. An existing
connection was forcibly closed by the remote host Failed to
download package 'System.Runtime.CompilerServices.Unsafe.6.0.0' from
'https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/6.0.0/system.runtime.compilerservices.unsafe.6.0.0.nupkg'.
Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host. An existing
connection was forcibly closed by the remote host Failed to
download package 'System.Runtime.CompilerServices.Unsafe.6.0.0' from
'https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/6.0.0/system.runtime.compilerservices.unsafe.6.0.0.nupkg'.
Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host. An existing
connection was forcibly closed by the remote host Failed to
download package 'System.Runtime.CompilerServices.Unsafe.6.0.0' from
'https://api.nuget.org/v3-flatcontainer/system.runtime.compilerservices.unsafe/6.0.0/system.runtime.compilerservices.unsafe.6.0.0.nupkg'.
Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Failed to restore C:\TFS_Workspaces\SDRnD\Main\Source\SDRnD.Api\SDRnD.Api.csproj
(in 10.37 sec).
Failed to restore C:\TFS_Workspaces\SDRnD\Main\Source\Tests\SDRnD.Architecture.Tests\SDRnD.Architecture.Tests.csproj
(in 10.37 sec).
NuGet package restore failed.
Please see Error List window for detailed warnings and errors.
I've tried creating a simple project in both VS2019 and VS2022, and installing the same package and get the same error. If I install version 5.0.0 of the package, that works, but the update to 6.0.0 fails.
My two colleagues have the same (new) laptops, same OS, same versions of VS, and neither have this issue with this solution/project and are able to update without issue.

I ended up deleting the contents of the folder:
C:\Users\MyId\AppData\Local\NuGet
Re-opened the solution and Package Manager then re-populated the contents. All sorted now.

Related

.NET 6.0: new Blazor project throws Websocket error

I am running currently a webserver with ASP.NET Core 3.1 and a Blazor project.
Recently when upgrading to .NET 6.0 I encountered (even with a blank Blazor project) some problems with a websocket error message in the browser only when deployed on my webserver (see message below).
Locally (on Windows 11 x64, VS 22 Preview 4) there are no error messages...
Webserver: Debian 10 x64, .NET 6.0 SDK installed, running on NGINX with websockets enabled (reverse proxy).
Do I miss out on something or is it a problem with the current state of .NET 6.0 and NGINX? I already tried to access the webpage locally on the debian server and the same error message occurs.
Help would be much appreciated!
Greetings!
Error messages within order:
Information: Normalizing '_blazor' to 'http://192.168.178.35/_blazor'.
blazor.server.js:1 WebSocket connection to 'ws://192.168.178.35/_blazor?id=wnPt_fXa9H4Jpia530vPWQ' failed:
Information: (WebSockets transport) There was an error with the transport.
Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.
Warning: Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling.
Here is the solution described again, maybe a little bit more convenient:
To fix this problem, I changed in the site-configuration (/etc/nginx/sites-available) of nginx the following variables:
proxy_set_header Connection $connection_upgrade;
to
proxy_set_header Connection $http_connection;
For me this solved the problem.

Cannot connect to database after installing Nuget Package Microsoft.Asp.Net.Webhelpers

I am having an issue with connecting to any of my databases after installing Microsoft.Asp.Net.Webhelpers. I have uninstalled it and still having an issue:
SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was
not found or was not accessible. Verify that the instance name is
correct and that SQL Server is configured to allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating
Server/Instance Specified)
My live site uses this database and is up and working. It does the same thing when I use my local machine connection. Does anyone know what this package may have changed in my project to cause this? I appologize if this is not the correct place to put it, I really do not know what code needs to be posted because everything was working fine before installing this package..
Thanks for your help!
UPDATE:
I am now showing an error that I need to restore with nuget package manager. Something is missing. It is set to automatically update missing packages but for some reason it doesn't. So I closed the program and will reboot my system and see what happens when I reopen and try to rebuild. I will do a clean first.
UPDATE:
The Problem package appears to be Microsoft.AspNet.Webpages.data which is a dependancy of `Microsoft.AspNet.WebHelpers. As soon as I install this package I loose database connectivity. I have not found any information on this issue anywhere. It seems strange to me because Microsoft has it under the latest version of .net. Which i am using..

Azure AD login failing when deployed on IIS

Azure ad authentication working fine with Visual studio IIS Express. But when publish and deploy in IIS server throwing error.
The application built on .NET core 3.1
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize&api-version=1.1'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize&api-version=1.1'.
---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
Firstly, make sure your IIS server has TLS 1.2 support enabled.
Also, enable TLS 1.2 support in your .net core application by adding below in startup, in the beginning of Main method of Program.cs.
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.ServicePointManager.SecurityProtocol;
Read more about TLS update in Azure here

Cannot connect to MS SQL from IIS [duplicate]

This question already has answers here:
IIS applicationHost 'setEnvironment' attribute
(2 answers)
Closed 3 years ago.
I'm developing a .net core application. I have local SQL server. When I debug application from Visual Studio, it works great. But when I publish app to folder and want to run it from IIS, it cannot connect to database.
From database I found this error messages for failed logins:
Error: 17204, Severity: 16, State: 1.
FCB::Open failed: Could not open file C:\Users\p4too\AppData\Local\Temp\VS11CodeIndex\Microsoft.VsCodeIndex_86bc9b9e_7c02_4fe0_9598_c87ac2dd85db.mdf for file number 0. OS error: 3(The system cannot find the path specified.).
I was looking for that file, but I did not found even folder VS11CodeIndex.
I use
Entity framework core 2.2.4
SQL Server Management Studio 15.0.18118.0
This is what solved the problem for me... you need to open C:\Windows\System32\inetsrv\config\applicationHost.config in Notepad and add setProfileEnvironment="true" to your AppPool.
In IIS, configure the app pool to run under an account with permissions to the DB on the server (advanced options of the app pool)
In the advanced option of the app pool, set Load User Profile to true

Unable to run the application from VS 2015 [duplicate]

This question already has an answer here:
"The underlying connection was closed: An unexpected error occurred on a send" after installing VS 2015 update 2
(1 answer)
Closed 4 years ago.
I am running my application using VS 2012 initially, That time it's working fine. After that we installed VS 2015 update 3. Now we are not able to run the application.
Getting Unable to start the debugging server on the web server. The Underlying connection was closed.An unexpected error occur on a send.
My application hosted in IIS, host entry fine with host file. I am able to run the application from IIS. And get the Verbosity -Diagnostic output. There is no conflicts between the packages. Firewall port is enabled as well as there is no Anti virus blocking.
Before installing VS 2015 it's working fine, Please let me know what is the issue here. Is there any .netframework conflicts, Please help to resolve the issue.
Try these:
Try changing the port being used to something other than 80 which may being used by another application.
Check to make sure the app pool has the right privileges.
Are VS2015 components installed on the remote to allow for VS2015 debugging? See Installing Remote Tools

Categories

Resources