我试图在Windows 2008 r2计算机上运行IIS下的MVC 6网站,但收到以下错误。使用web.cmd
而没有IIS的同一网站正常工作。
Failed to resolve the following dependencies for target framework 'Asp.Net,Version=v5.0':
BouncyCastle 1.7.0.0
EntityFramework 7.0.0-beta3-12021
EntityFramework.Commands 7.0.0-beta3
EntityFramework.Migrations 7.0.0-beta2-11941
EntityFramework.Relational 7.0.0-beta3-12021
EntityFramework.SqlServer 7.0.0-beta3
....and a whole long list....
下面是我的web.config。我已将IIS指向wwwroot
文件夹。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta3" />
<add key="runtime-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta3" />
<add key="kre-clr" value="clr" />
<add key="kre-app-base" value="..\approot\src\MySite" />
</appSettings>
</configuration>
这是我的project.json
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta3",
"EntityFramework.Commands": "7.0.0-beta3",
"Microsoft.AspNet.Mvc": "6.0.0-beta3",
/* "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-beta3", */
"Microsoft.AspNet.Diagnostics": "1.0.0-beta3",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta3",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta3",
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta3",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta3",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta3",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta3",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta3",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta3",
"Microsoft.Framework.Logging": "1.0.0-beta3",
"Microsoft.Framework.Logging.Console": "1.0.0-beta3",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta1",
"EntityFramework": "7.0.0-beta3-12021",
"EntityFramework.Relational": "7.0.0-beta3-12021",
"EntityFramework.Migrations": "7.0.0-beta2-11941",
"Microsoft.Framework.DependencyInjection": "1.0.0-beta3",
"Microsoft.AspNet.WebUtilities": "1.0.0-beta3-10816",
"Microsoft.AspNet.FileSystems": "1.0.0-beta3-10698",
"System.Net.Http": "4.0.0.0-beta-22416",
"System.Data.Common": "1.0.0-beta2",
"Microsoft.AspNet.Identity": "3.0.0-beta3",
"Microsoft.AspNet.Security.Facebook": "1.0.0-beta3",
"Microsoft.AspNet.Security.Google": "1.0.0-beta3",
"Microsoft.Framework.OptionsModel": "1.0.0-beta3",
"HtmlAgilityPack": "1.4.9.0",
"YUICompressor.NET": "2.7.0.0",
"Newtonsoft.Json": "6.0.7.0",
"Moq": "4.2.1409.1722",
"System.Linq.Dynamic": "1.0.4.0",
"System.Net.Primitives": "4.0.10.0-beta-22416",
"Microsoft.AspNet.Session": "1.0.0-beta3-10674",
"Microsoft.Framework.Cache.Redis": "1.0.0-beta3",
"Microsoft.Framework.Cache.Memory": "1.0.0-beta3"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
"gen": "Microsoft.Framework.CodeGeneration",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"aspnet50": {
"frameworkAssemblies": {
"System.Web.Services": ""
}
},
/*"aspnetcore50": {}*/
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"bundleExclude": [
"node_modules",
"bower_components",
"**.kproj",
"**.user",
"**.vspscc"
],
"scripts": {
"postrestore": [ "npm install" ],
"prepare": [ "grunt bower:install" ]
}
}
更新 我试图在Windows 10上运行一个基本的示例应用程序,它对我不起作用。这是链接:http://www.filedropper.com/iissampleapp
我认为问题在于我试图在解决方案中使用两个网络应用程序?
答案 0 :(得分:0)
您正在使用beta2
和beta3
个套餐。不要混合它们,这只是在寻找麻烦。在您的情况下,您有EntityFramework.Relational 7.0.0-beta3-12021
和EntityFramework.Migrations 7.0.0-beta2-11941
。另外,不要混合开发和发布包。开发包是最后有4-5位数字的包(如12021
),而发布包只是以beta3
或beta2
结尾的包。它们是在不同时刻制作的,并不能保证它们能够协同工作。
修复软件包后,请尝试以下操作:
在app的文件夹中运行(如果你的目标是32位机器,用x86替换x64):
kpm bundle --runtime kre-clr-win-x64.1.0.0-beta3
这将生成一个包含您的应用程序,其依赖项和CLR的文件夹。
然后在IIS的网站根目录下复制并尝试再次运行。