部署Visual Studio Web应用程序到IIS(甚至Azure的持续部署GIT)?(Depl

2019-10-23 13:05发布

我想从2015年VS RC部署我的MVC 6 Web应用程序。 我使用IIS 7.5。 我曾经浏览其他用户的关于类似的部署问题,但他们的解决方案并没有为我工作...

具体来说,我下面这个指南(失败): http://dotnetspeak.com/2015/03/publish-asp-net-v-next-to-iis

我真的只是想发布的默认.NET 5 / MVC 6 Visual Studio的Web应用程序...以下是详细交代什么,我都试过了。 不知道我做错了。 我承认,我很生疏与IIS和.NET。 所以,请记住这一点!


的Visual Studio 2015年的Web发布

笔者告诉你:

右键单击默认Web站点,然后选择添加应用程序

所以我的值在“发布网站”使用:

  • 配置文件名称:DerekFoulk.com
  • 目标位置:C:\的Inetpub \ wwwroot的\ DerekFoulk.com
  • 配置: 发行
  • 目标DNX版本: 默认(DNX-CLR-双赢x86.1.0.0-BETA4)
  • 发布脚本: 使用PowerShell脚本发布

然后我看到:

您的应用程序将被发布到:

C:\的Inetpub \ wwwroot的\ DerekFoulk.com

所以我点击发布


添加到IIS 7.5

我这样做之前,我注意到,有已经在IIS这是标题相同的名称作为我的项目的条目。 难道这是因为我一直在使用默认的“开始调试 - IIS Express的事实按钮预览我的应用程序在我的浏览器?

然后我打开了IIS并用鼠标右键单击默认Web站点和打击添加应用程序 。 我使用了以下配置:

  • 别名:DerekFoulk
  • 应用程序池: 默认应用
  • 物理路径:C:\的Inetpub \ wwwroot的\ DerekFoulk.com \ wwwroot文件
  • 通过身份验证

然后我打了测试设置 ,并得到了以下错误信息:

执行此操作时发生错误。

细节:

无效的应用程序路径

笔者没有提到检查设置,即使我知道这将意味着事情就无法正常工作,我点击确定

最后,笔者认为到:

转到安全TestApp文件夹下的Windows资源管理器。 添加Authenticated Users组的帐户,并给它读取和执行权限。

所以我右键单击目录(C:\的Inetpub \ wwwroot的\ DerekFoulk.com)和去属性>安全 ,并没有看到Authenticated Users组。 我没有,但是,看到了IIS_IUSRS 读取和执行权限。 我想这些都是适当的权限,并继续尝试查看我的应用程序在浏览器...

我浏览到HTTP://本地主机/ DerekFoulk / 。 它显示在页面上出现以下错误:

 <!DOCTYPE html> <html> <head> <title>Could not load file or assembly 'dnx.clr.managed' or one of its dependencies. The system cannot find the file specified.</title> <meta name="viewport" content="width=device-width" /> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/DerekFoulk' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Could not load file or assembly 'dnx.clr.managed' or one of its dependencies. The system cannot find the file specified.</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br><br> <b> Exception Details: </b>System.IO.FileNotFoundException: Could not load file or assembly 'dnx.clr.managed' or one of its dependencies. The system cannot find the file specified.<br><br> <b>Source Error:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code> An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code> </td> </tr> </table> <br> <b>Assembly Load Trace:</b> The following information can be helpful to determine why the assembly 'dnx.clr.managed' could not be loaded.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. </pre></code> </td> </tr> </table> <br> <b>Stack Trace:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> [FileNotFoundException: Could not load file or assembly &#39;dnx.clr.managed&#39; or one of its dependencies. The system cannot find the file specified.] [TypeLoadException: The domain manager specified by the host could not be instantiated.] System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +556 [HttpException (0x80004005): The domain manager specified by the host could not be instantiated.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726 </pre></code> </td> </tr> </table> <br> <hr width=100% size=1 color=silver> <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.57.0 </font> </body> </html> <!-- [FileNotFoundException]: Could not load file or assembly &#39;dnx.clr.managed&#39; or one of its dependencies. The system cannot find the file specified. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName) at System.AppDomain.CreateAppDomainManager() [TypeLoadException]: The domain manager specified by the host could not be instantiated. at System.AppDomain.CreateAppDomainManager() at System.AppDomain.Setup(Object arg) at System.AppDomain.nCreateDomain(String friendlyName, AppDomainSetup setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr parentSecurityDescriptor) at System.AppDomain.InternalCreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info) at System.AppDomain.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info) at AspNet.Loader.Bootstrapper.LoadApplicationNet45(String appId, String appConfigPath, IProcessHostSupportFunctions supportFunctions, LoadApplicationData* pLoadAppData, Int32 loadAppDataSize, String runtimePackagePath, String appBasePath) at AspNet.Loader.Bootstrapper.LoadApplication(String appId, String appConfigPath, IProcessHostSupportFunctions supportFunctions, LoadApplicationData* pLoadAppData, Int32 loadAppDataSize) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Web.Hosting.ProcessHost.System.Web.Hosting.IProcessHostLite.ReportCustomLoaderError(String appId, Int32 hr, AppDomain newlyCreatedAppDomain) --- End of stack trace from previous location where exception was thrown --- at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters) at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) [HttpException]: The domain manager specified by the host could not be instantiated. at System.Web.HttpRuntime.FirstRequestInit(HttpContext context) at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) --> 

The snippet above has some details on the error at the bottom of the page, but I can't interpret them...

I don't think the publishing is the problem. I think I am doing something wrong in IIS... Anyways, any advice on how to publish an MVC 6 app to local IIS would be greatly appreciated! Thanks!


Update

Interesting observation... I tried to deploy to Microsoft Azure as a Web App by following these instructions: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-continuous-delivery-use-vso-git/

The app builds great on my local machine with no errors, but when I tried to deploy to Azure using the Git/Team Services integration, I received the following error:

body {
  font-family: Verdana, sans-serif;
}

span {
  color: #c00;
  font-weight: bold;
  font-style: italic;
}
Build started 6/25/2015 9:50:58 PM.<br>
&nbsp;&nbsp;&nbsp;&nbsp;1>Project "C:\a\src\DerekFoulk.sln" on node 1 (default targets).<br>
&nbsp;&nbsp;&nbsp;&nbsp;1>ValidateSolutionConfiguration:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Building solution configuration "Debug|Any CPU".<br>
&nbsp;&nbsp;&nbsp;&nbsp;1>Project "C:\a\src\DerekFoulk.sln" (1) is building "C:\a\src\src\DerekFoulk\DerekFoulk.xproj" (2) on node 1 (default targets).<br>
&nbsp;&nbsp;&nbsp;&nbsp;2>PrepareForBuild:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creating directory "..\..\artifacts\obj\DerekFoulk\Debug\".<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PreComputeCompileTypeScript:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\tsc.exe  --noEmitOnError COMPUTE_PATHS_ONLY<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CompileTypeScript:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Skipping target "CompileTypeScript" because it has no outputs.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetRuntimeToolingPathTarget:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>Cannot find DNX runtime dnx-clr-win-x86.1.0.0-beta4 in the folder: C:\Users\buildguest\.dnx\runtimes</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(117,5): error : The Dnx Runtime package needs to be installed. See output window for more details. [C:\a\src\src\DerekFoulk\DerekFoulk.xproj]<br>
&nbsp;&nbsp;&nbsp;&nbsp;2>Done Building Project "C:\a\src\src\DerekFoulk\DerekFoulk.xproj" (default targets) -- FAILED.<br>
&nbsp;&nbsp;&nbsp;&nbsp;1>Done Building Project "C:\a\src\DerekFoulk.sln" (default targets) -- FAILED.<br>
<br>
Build FAILED.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"C:\a\src\DerekFoulk.sln" (default target) (1) -><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"C:\a\src\src\DerekFoulk\DerekFoulk.xproj" (default target) (2) -><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(GetRuntimeToolingPathTarget target) -> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(117,5): error : The Dnx Runtime package needs to be installed. See output window for more details. [C:\a\src\src\DerekFoulk\DerekFoulk.xproj]<br>
<br>
&nbsp;&nbsp;0 Warning(s)<br>
&nbsp;&nbsp;1 Error(s)<br>
<br>
Time Elapsed 00:00:10.40<br>

So I can't do anything with a default .NET 5/MVC 6 Web App? Literally, I can only preview it?


Update

I was able to publish the site to Azure as a Web App using Build > Publish > Microsoft Azure Web Apps, but even after deleting everything and starting from scratch, I cannot get Continuous Deployment from Source Control (Git) / Visual Studio Team Services to deploy. The build fails, still saying

建立(-1,0)异常消息:MSBuild的错误1已经结束这个构建。 你可以找到关于此错误的上述消息的原因的更多具体信息。 (类型BuildProcessTerminateException)异常堆栈跟踪:在System.Activities.Statements.Throw.Execute(CodeActivityContext上下文)在System.Activities.CodeActivity.InternalExecute(ActivityInstance例如,ActivityExecutor执行人,BookmarkManager bookmarkManager)在System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem .ExecuteBody(ActivityExecutor执行人,bookmarkManager bookmarkManager,地点resultLocation)C:\ Program Files文件(x86)的\的MSBuild \微软\ VisualStudio的\ v14.0 \ DNX \ Microsoft.DNX.targets(117,0)对DNX运行包必须安装。 见输出窗口的更多细节。

有没有人通过的Git / Visual Studio团队服务能够建立持续部署? 如果是这样,怎么样?


更新(从SVN / Team Services的持续构建)

所以下面可能是问题,当构建失败:

现在,我们可以构建解决方案。 由于默认网页模板目标既充分.NET和.NET的核心,我们希望当它试图访问的HomeController的Environment.MachineName和Environment.OSVersion变量构建失败。 此行为不会在.NET核心(目前)工作,所以我们可以把它注释掉。 打开project.json和修改“框架”键,如图所示:

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

更新

下面是从构建失败日志文件: OneDrive -日志文件希望有人看到了这一点,能不能帮我破解的难题,使我的网站将部署到Azure中,当我推提交。 在开发过程中这将是伟大的!

Answer 1:

这是一个有点难以启齿,但可能是由于你的目标发布路径和IIS应用程序的物理路径不匹配......

目标位置:C:\的Inetpub \ wwwroot的\ DerekFoulk.com

物理路径:C:\的Inetpub \ wwwroot的\ DerekFoulk.com \ wwwroot文件



Answer 2:

谢谢你的工作,我希望我的回答可以帮助别人。 我碰到了同样的错误有关的海报“无法加载文件或程序集dnx.clr.managed'或它的一个依赖。” 我没有注意到,启用32位应用程序在我的应用程序池设置为“假”。 将其设置为“True”解决我的问题。



Answer 3:

部署过程,说明这里 。 花几分钟阅读帖子的链接,上上更改IIS应用程序的.NET托管模式触摸。

确保我有我的服务器上安装了正确的.NET版本后(我用DNVM ),我能得到我的应用程序启动和运行我的本地IIS机器上。

我希望这可以帮助别人!



Answer 4:

这将与DnxRuntime问题特别有帮助。

当VS团队服务构建它所需要的,我们使用的基础上开发个人电脑的东西。

基本上,你创建一个预生成脚本下载dnvm,安装它最后调用DNU恢复为每个project.json文件。 作品你最好有一个src子目录中的所有代码,并有global.json文件。

我根据我的这篇文章的解决方案,你可以找到脚本: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5



Answer 5:

关于部署到Azure的:

正如丹尼尔提到的夏普有https://msdn.microsoft.com/Library/vs/alm/Build/azure/deploy-aspnet5我得到了工作。 在一个变化,我需要做我在答复中提到这个问题构建ASP.NET 5从Visual Studio在线ERROR_FILE_IN_USE Azure的网站 。

稍微不同的路线不使用Visual Studio发布(在VS团队服务),而是在DNU发布命令。 我经过,在相当多的细节在博客中,你可以在这里找到: http://devonburriss.me/aspnet-vsonline-ci/

让我们知道您的身体情况如何。 看起来你已经花了相当多的时间在这了。



文章来源: Deploy Visual Studio Web App to IIS (Maybe Even Azure Continuous Deployment Git)?