Wrong version of JQuery being loaded

2019-08-10 01:00发布

I recently opened up an old Asp.Net application I was working on and updated the Nuget packages. When I try to run this app I get the following errors:

http://localhost:7055/Scripts/jquery-1.8.2.min.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:7055/Scripts/jquery.signalR-1.0.0.js Failed to load resource: the server responded with a status of 404 (Not Found)`

The above was taken from the Chrome console tab.

Here is what my page source shows in Chrome:

<!--Script references. -->
<!--Reference the jQuery library. -->
<script src="/Scripts/jquery-1.8.2.min.js" ></script>
<!--Reference the SignalR library. -->
<script src="/Scripts/jquery.signalR-1.0.0.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="/signalr/hubs"></script>

However, that is NOT the versions I am referencing in the actual source. Here is my actual source:

<!--Script references. -->
<!--Reference the jQuery library. -->
<script src="/Scripts/jquery-2.1.4.min.js" ></script>
<!--Reference the SignalR library. -->
<script src="/Scripts/jquery.signalR-2.2.0.min.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="/signalr/hubs"></script>

Here is the contents of my packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="jQuery" version="2.1.4" targetFramework="net45" />
  <package id="Knockout.Mapping" version="2.4.0" targetFramework="net45" />
  <package id="knockoutjs" version="3.3.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.SignalR" version="2.2.0" targetFramework="net45" />
  <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="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
  <package id="Mongodb" version="1.7.1.4791" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
  <package id="Owin" version="1.0" targetFramework="net45" />
</packages>

I have tried cleaning, stopping all IIS Express sites, deleting the temp files from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ and rebuilding and still the problem persists.

Where is it pulling this old reference from? I have no other script references in my code.

Thanks in advance,

Greg.

1条回答
Melony?
2楼-- · 2019-08-10 01:43

I had the same problem and this is how I fixed it.

1. Print the version that the system is loading like so:
    console.log( "You are running jQuery version: " + $.fn.jquery);
2. View the source of the html page rendered.
3. Look for all the jquery source added, checking at <script> imports.
4. Then look for your source code where this is getting added.
5. Fix that, build, and repeat step 2 until you get the right version.

Good luck.

查看更多
登录 后发表回答