Sometimes we need to add some headers for static file requests.
For example, if we want to allow third-party website to access images or audios
through XHR (it’s usefull when you want to do some custom decoding with these files).
You need to add Access-Control-Allow-Origin: *
(relpace *
with your domain if you don’t realy want to allow any domain to access).
Take a look at this
h1{
color: red;
}
.content h1{
color: green;
}
.content .header h1 {
color: blue;
}
.content .header{
color: purple;
}
.content .header h1 {
color: inherit;
}
The h1
will take the color purple
instead of green
.
The inherit CSS-value causes the element for which it is specified to take the computed value of the property from its parent element. It is allowed on every CSS property.
That’s it.
阅读原文>>.net core RTM 了,Azure global 已经提供支持,但是慢半拍的 Azure 中国 WebSites 目前并不支持 asp.net core。
Orz
经过各种尝试,终于发现了临时解决的办法:
让我们把整个 .net core 上传上去把
操作步骤
wwwroot
的父级目录, 让我们能够在 wwwroot
使用 ..\dotnet\dotnet.exe
访问到它。web.config
将 configuration\system.webServer\aspNetCore@processPath
由 %LAUNCHER_PATH%
或 dotnet
改为 ..\dotnet\dotnet.exe
:)
有一个问题是,Visual Studio 发布项目后,会自动把 processPath
改为 dotnet
,避免每次上传手动修改,我们在 project.json
中添加一个后处理脚本
// project.json
"scripts": {
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%",
"node azurecn.js %publish:OutputPath%" // <====== 执行 node 脚本,替换processPath
]
}
// azurecn.js
var fs = require('fs');
var path = require('path');
var folder = process.argv[2];
var filePath = path.join(folder, 'web.config');
console.log(filePath);
var content = fs.readFileSync(filePath, 'utf-8');
if (content.indexOf('processPath="dotnet"') > 0) {
content = content.replace('processPath="dotnet"', 'processPath="..\dotnet\dotnet.exe"');
fs.writeFileSync(filePath, content);
}
阅读原文>>整个世界都美好了!(●’◡’●)