我正在开发一个使用Google字体的网站,Open Sans
如下所示:
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700italic,800italic,800,700' rel='stylesheet' type='text/css'>
Run Code Online (Sandbox Code Playgroud)
通常情况下,我在使用我的网站时使用Chrome,但今天我决定在Windows 10上看到它在IE 11(11.0.10240.16431)中的外观.不幸的是,Open Sans
没有正确加载和渲染.我在Developer Tools控制台中看到了很多这些错误:
CSS3111: @font-face encountered unknown error.
PRmiXeptR36kaC0GEAetxjqR_3kx9_hJXbbyU8S6IN0.woff
Run Code Online (Sandbox Code Playgroud)
认为这很奇怪 - 我以前开发过一个网站,可以在IE 10中轻松加载Google字体 - 我转向https://www.google.com/fonts.更多CSS3111
错误,serif
而是显示每个自定义字体:
对于IE 11,谷歌字体是否已被破坏?字体在Edge,Chrome,Firefox等中正确加载.我对如何使这些字体在IE中工作感到茫然.
更新1
在IE 11中将模拟文档模式设置为8会导致字体正确呈现.然而,IE 9+仍然表现出同样的问题.这可能是谷歌某种不正确的用户代理字符串处理吗?
更新2
我去了FontSquirrel并下载了所有格式的Open Sans.我还导入了ZIP中提供的CSS.不幸的是,IE和现在的Firefox继续报告该字体无法使用.Firefox说downloadable font: not usable by platform
.
更新3
我已经确认所有安全区域的IE的字体下载设置都设置为Enabled.
我已经在StackOverflow和其他站点上的其他几个线程上读到了这个问题.其他解决方案都没有解决我的问题,而且大多数已经过时,引用了旧版本的Azure SDK.
我有一个典型的Azure网站角色部署到Azure,用于Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener
记录跟踪消息.当发生跟踪时,看起来好像DiagnosticMonitorTraceListener
正在使用RoleEnvironment
类,而后者又试图加载明显不存在的类msshrtmi.dll
.以下是在Azure中记录到文件系统的堆栈跟踪的一部分:
[FileNotFoundException: Could not load file or assembly 'msshrtmi, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() +0
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() +747
[TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() +0
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +23
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34
[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +9004943
System.Diagnostics.TypedElement.BaseGetRuntimeObject() +110
System.Diagnostics.ListenerElement.GetRuntimeObject() +989
System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +252
System.Diagnostics.TraceInternal.get_Listeners() +331
System.Diagnostics.TraceInternal.WriteLine(String message) +161 …
Run Code Online (Sandbox Code Playgroud) 一张图片值1000字,所以这里有几张图片(忽略我的编辑):
我在此解决方案中的任何项目中都没有引用或使用Entity Framework.在我安装了一堆Windows更新后,这种情况刚刚开始发生.共有九个警告.我正在运行Windows 8.1 Pro,但我不知道这是否重要.我在同一解决方案中有其他项目,具有相同的项目类型和.NET框架版本.该项目本身似乎在IIS中运行良好.我的所有Web.config文件都具有类似的配置和结构.这是有问题的(更多编辑):
<?xml version="1.0"?>
<configuration>
<configSections>
...
</configSections>
...
<connectionStrings>
...
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5.1"/>
<authentication mode="None"/>
<sessionState mode="Off"/>
<customErrors mode="RemoteOnly"/>
<httpRuntime enableHeaderChecking="false" enableVersionHeader="false" requestValidationMode="2.0" sendCacheControlHeader="false" targetFramework="4.5.1"/>
</system.web>
<system.webServer>
<httpErrors existingResponse="PassThrough"/>
<validation validateIntegratedModeConfiguration="true"/>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" httpExpires="7.00:00:00"/>
</staticContent>
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true"/>
<defaultDocument>
<files>
<clear/>
</files>
</defaultDocument>
</system.webServer>
<system.runtime.caching>
<memoryCache>
<namedCaches>
...
</namedCaches>
</memoryCache>
</system.runtime.caching>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" …
Run Code Online (Sandbox Code Playgroud) 首先,一些背景信息:我有一个 Visual Studio 解决方案,其中包含几个生产类库和九个单元测试项目。所有项目都针对 .NET 5。我正在运行 .NET 5.0.401。所有单元测试项目都引用了coverlet.collector
. 我不使用旧的coverlet.msbuild
软件包。根据我的阅读,使用XPlat Code Coverage
现在是 .NET Core 的惯用法。
我有一个用于 CI 构建的 Azure Pipelines 管道。作为此管道的一部分,我想运行所有单元测试,生成单元测试结果以上传到管道,并生成代码覆盖率结果以上传到管道。我已经阅读了几篇博客文章和文档,这些文章和文档似乎使这一切变得简单;然而,我发现事实并非如此。
让我们从在本地工作站上运行一些命令开始简单。出于本练习的目的,我们假设我已经使用以下命令成功构建了解决方案:
dotnet build Solution.sln --configuration Debug
Run Code Online (Sandbox Code Playgroud)
如果我运行这样的测试:
dotnet test Solution.sln --configuration Debug --no-build --no-restore --collect:"XPlat Code Coverage" --results-directory artifacts/test-results
Run Code Online (Sandbox Code Playgroud)
然后我看到代码覆盖率结果存储在以 GUID 命名的子目录中。我不知道微软为什么决定这样做,但这不是我所能控制的。
(运行此命令并截图后,我删除了该test-results
目录。)
请记住,我还想生成单元测试结果。为此,我将--logger trx
参数添加到同一命令行中。这次,创建了许多其他文件夹,其中包含看似重复的代码覆盖率结果。此外,我还得到了.trx
我正在寻找的文件。
您会注意到,除了.trx
我想要的九个文件之外,还有另外九个代码覆盖率报告。
我的自托管 Pipelines 构建代理上会生成类似的重复文件。在管道中,如果我尝试执行以下任务:
dotnet build Solution.sln --configuration Debug
Run Code Online (Sandbox Code Playgroud)
我收到错误:
##[warning]Multiple file or directory matches were found. Using the …
Run Code Online (Sandbox Code Playgroud) 我最近将Serilog集成到了几个.NET Standard类库中,包括一些MVC 6项目使用的类库.我想做的是丰富日志条目HttpContext.TraceIdentifier
.我写了一个动作过滤器,设置HttpContext.TraceIdentifier
为Correlation-ID
请求标头值,如果存在:
public override void OnActionExecuting(ActionExecutingContext context)
{
StringValues correlationIds;
Guid correlationId;
if (!context.HttpContext.Request.Headers.TryGetValue(Constants.CorrelationIdHeaderName, out correlationIds) || correlationIds.Count != 1 || !Guid.TryParse(correlationIds[0], out correlationId))
{
correlationId = _guidFactory.Random();
context.HttpContext.Response.Headers.Add(Constants.CorrelationIdHeaderName, correlationId.ToString("D"));
}
context.HttpContext.TraceIdentifier = correlationId.ToString("D");
base.OnActionExecuting(context);
}
Run Code Online (Sandbox Code Playgroud)
问题是,在请求的生命周期中,如何让Serilog知道相关ID?由于它看起来好像没有HttpContext.Current
属性,我不知道如何创建一个可以工作的丰富器.这甚至可能吗?
我有一个简单的iOS应用程序,我正在集成谷歌地图.但是,当我的地图视图显示时,我提供的API密钥会导致其中一些错误消息:
ClientParametersRequest failed, 3 attempts remaining (0 vs 5). Error Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be completed. (com.google.HTTPStatus error 400.)" UserInfo=0x1818bf40 {data=<CFData 0x18137410 [0x302aec8]>{length = 145, capacity = 256, bytes = ...}}
这是我已经尝试过无效的事情:
[GMSServices provideAPIKey:]
作为代码内的第一线didFinishLaunchingWithOptions
{}
和不使用API密钥[[Bundle mainBundle] bundleIdentifier]
我不知道还有什么可以尝试的.我的捆绑包名称采用以下格式:net.company.MyApp
我已将其完全输入Google云端控制台(我知道捆绑包ID区分大小写).
可能是Google不支持某种类型的捆绑标识符(例如,使用大写字母或以net.
?开头)?
.net ×2
azure ×1
c# ×1
css ×1
dotnet-cli ×1
dotnet-test ×1
fonts ×1
ios ×1
serilog ×1
web-config ×1