当我为我的ASP.Net Core 1.1应用程序启用browserLink时,我在浏览器中收到以下错误,我认为因为browserLink不起作用.
browser Link: Exception thrown when trying to invoke browser Link extension callback "microsoft.visualstudio.web.browserlink.sourcemappingextensionfactory.getCssMappingData": System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.EnsureAbsoluteUrl(IVsHierarchy hierarchy,Uri& path) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.GetSimpleVsWebUrlFromUrl(IVsHierarchy hierarchy,Uri url,ILocationContainer& container) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.GetVsWebUrlFromUrl(IVsHierarchy hierarchy,Uri url) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.LazyLocationContainerFromUrl.CreateActualLocationContainer() at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.GetPhysicalPath(Uri& physicalPath) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.DocumentLocation.Microsoft.VisualStudio.Web.Extensions.Common.Helpers.IDocumentLocation.GetPhysicalPath(Uri& physicalPath) at Microsoft.VisualStudio.Web.browserLink.sourceMappingExtension.getCssMappingData(String cssUrl,String[] selectors) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target,Object[] arguments,Signature sig,Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,Object[] parameters,Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,CultureInfo culture) at Microsoft.VisualStudio.Web.browserLink.ClientMessaging.dispatchMessage(browserLinkConnection connection,MessageArgs obj) browser Link: Exception thrown when trying to invoke browser Link extension callback "microsoft.visualstudio.web.browserlink.autosyncextensionfactory.trackCssDocuments": System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.EnsureAbsoluteUrl(IVsHierarchy hierarchy,Uri url) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.LazyLocationContainerFromUrl.CreateActualLocationContainer() at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.GetPhysicalPath(Uri& physicalPath) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.DocumentLocation.Microsoft.VisualStudio.Web.Extensions.Common.Helpers.IDocumentLocation.GetPhysicalPath(Uri& physicalPath) at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.DocumentLocation.Microsoft.VisualStudio.Web.Extensions.Common.Helpers.IDocumentLocation.get_PhysicalFileExists() at Microsoft.VisualStudio.Web.browserLink.AutoSyncExtension.trackCssDocuments(String[] trackHrefs,String[] untrackHrefs) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target,MessageArgs obj) browser Link: Failed to invoke return value callback: TypeError: Cannot read property 'files' of null
我已将我的应用程序配置如下:
.csproj配置:
<ItemGroup> <packagereference Include="AutoMapper" Version="5.2.0" /> <packagereference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="1.2.0" /> <packagereference Include="BundlerMinifier.Core" Version="2.4.337" /> <packagereference Include="IdentityModel" Version="2.5.1" /> <packagereference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" /> <packagereference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.1.1" /> <packagereference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" /> <packagereference Include="Microsoft.AspNetCore" Version="1.1.1" /> <packagereference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> <packagereference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" /> <packagereference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" /> <packagereference Include="Microsoft.EntityFrameworkCore.sqlServer" Version="1.1.1" /> <packagereference Include="Microsoft.EntityFrameworkCore.sqlServer.Design" Version="1.1.1" PrivateAssets="All" /> <packagereference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" /> <packagereference Include="Microsoft.Extensions.Configuration.Environmentvariables" Version="1.1.1" /> <packagereference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" /> <packagereference Include="Microsoft.Extensions.Logging" Version="1.1.1" /> <packagereference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" /> <packagereference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> <packagereference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" /> <packagereference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" /> <packagereference Include="Microsoft.VisualStudio.Web.browserLink" Version="1.1.0" /> <packagereference Include="Serilog.Extensions.Logging.File" Version="1.0.0" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /> </ItemGroup> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <Exec Command="bower install" /> <Exec Command="dotnet bundle" /> </Target>
在Configure方法的Startup.cs文件中,我调用了app.UsebrowserLink();.
UPDATE
似乎错误与* .css文件有关.如果我删除所有CSS链接,我只会收到以下错误:
browser Link: Failed to invoke return value callback: TypeError: Cannot read property 'files' of null
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。