asp.net-core – 在Visual Studio 2017 RTM上,BrowserLink不适用
发布时间:2020-12-16 03:50:12 所属栏目:asp.Net 来源:网络整理
导读:当我为我的ASP.Net Core 1.1应用程序启用BrowserLink时,我在浏览器中收到以下错误,我认为因为BrowserLink不起作用. Browser Link: Exception thrown when trying to invoke Browser Link extension callback "microsoft.visualstudio.web.browserlink.source
当我为我的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 解决方法
我通过删除默认的browserlink包修复了这个问题
和安装
这个包在guide from Microsoft docs中被提到.不确定有什么不同但它似乎解决了我的问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 使用asp.net标识更新用户角色
- asp.net – 在ASP MVC 6中为多个路由分配给同一个控制器或者
- asp.net-mvc – 是否有可能在ASP.NET MVC中对一些AddModelE
- asp.net-mvc-3 – 与SQL Server建立连接时发生与网络相关或
- asp.net – 服务器标签格式不正确,ASP Repeater Datasource
- 在.NET Core中使用简单的插件化机制
- ASP.NET Web Pages - HTML 窗体
- asp.net-mvc – 如何将自定义css文件添加到asp.net mvc?
- asp.net – 不能从代码隐藏在FormView上加载DropDownList?
- asp.net-mvc-4 – 如何在MVC 4中从tempdata获取对象
推荐文章
站长推荐
- asp.net-mvc – 我们应该使用Entity Framework C
- asp.net-mvc – ASP.NET MVC RC中的Html.Image在
- asp.net-mvc – ASP.NET MVC Javascript ActionR
- asp.net-mvc – 如何在控制器中显示警报消息
- asp.net-mvc – 如何处理ASP.NET MVC中动态生成的
- Favicon只在主页ASP.NET MVC中显示
- 在asp.net中删除字符串变量中的整数值
- asp.net-mvc – 从递归模型创建表单
- asp.net-mvc – WebApiConfig.cs和RouteConfig.c
- iis-7 – 使用asp.net在开发机器上创建无cookie应
热点阅读