文章出處

Kestrel是目前在非Windows平臺上運行ASP.NET 5應用程序的唯一可用Web服務器,但微軟似乎將它冷落在一邊,源代碼更新很慢。

今天試著在Linux上編譯Kestrel的源代碼,遇到了很多問題。在這篇博文中記錄一下。

運行編譯命令:

./build.sh

出錯信息:

-bash: ./build.sh: Permission denied

修復方法:

chmod +x build.sh

再次編譯,出錯:

./build.sh: line 31: packages/KoreBuild/build/kvm.sh: No such file or directory
./build.sh: line 35: kvm: command not found

修復方法:在build.sh中刪除以下的代碼:

if ! type k > /dev/null 2>&1; then
    source packages/KoreBuild/build/kvm.sh
fi

if ! type k > /dev/null 2>&1; then
    kvm upgrade
fi

繼續編譯,出錯:

Unable to locate xunit.runner.kre >= 1.0.0-*
Writing lock file /data/git/KestrelHttpServer/test/Microsoft.AspNet.Server.KestrelTests/project.lock.json
Restore complete, 192ms elapsed
Total time 1067ms
Errors in /data/git/KestrelHttpServer/test/Microsoft.AspNet.Server.KestrelTests/project.json
    Unable to locate xunit.runner.kre >= 1.0.0-*

修復方法:將 test/Microsoft.AspNet.Server.KestrelTests/project.json 文件中的 kre 改為 aspnet,vim 命令如下:

:%s/kre/aspnet/g 

繼續編譯,出現錯誤:

/data/git/KestrelHttpServer/src/Kestrel/ServerFactory.cs(1,24): error CS0234: The type or namespace name 'Hosting' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
...

修復方法:修改 src/Kestrel/project.json 中的 frameworks 部分,修改為:

"frameworks": {
     "dnx451": { },
     "dnxcore50": { }
}

繼續編譯,出現新的錯誤:

src/Kestrel/ServerFactory.cs(4,27): error CS0234: The type or namespace name 'ConfigurationModel' does not exist in the namespace 'Microsoft.Framework' (are you missing an assembly reference?)

修復方法:在 src/Kestrel/project.json 中添加 Microsoft.Framework.ConfigurationModel 的引用

{
    "dependencies": {
"Microsoft.Framework.ConfigurationModel": "1.0.0-*"
} }

繼續編譯,出現新的錯誤:

src/Kestrel/ServerRequest.cs(1,24): error CS0234: The type or namespace name 'HttpFeature' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)

修復方法:在 src/Kestrel/project.json 中添加 Microsoft.AspNet.HttpFeature 的引用

"Microsoft.AspNet.HttpFeature": "1.0.0-*"

但該修復方法無效,依然出現同樣的錯誤。。。就卡在這,沒找到解決方法。

于是,這次編譯嘗試 Kestrel 失敗。


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()