重命名 ASP.NET 项目文件后,无法让 OWIN 启动类在 IIS Express 中运行 [英] Can't get the OWIN Startup class to run in IIS Express after renaming ASP.NET project file

查看:16
本文介绍了重命名 ASP.NET 项目文件后,无法让 OWIN 启动类在 IIS Express 中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了需要在基于 OWIN 的 WebAPI 网站中更改解决方案和项目名称的情况.在此更改之前,一切都运行良好,据我所知,重命名成功的原因如下:

I've got a situation where I needed to change the solution and project names within a OWIN-based WebAPI website. Everything worked great before this change, and to my knowledge the renaming was successful because of the following:

  1. 该解决方案构建良好,我所有的单元测试都在本地和我们的 TeamCity 构建服务器上成功运行
  2. 该应用程序在我们的测试服务器(完整的 IIS 8)和生产环境(也是完整的 IIS 8)上运行良好

我的问题是,在重命名之后,无论我尝试什么,当我在 IIS Express 中运行它时,都无法执行 Startup 类.我怀疑我的机器上有一些包含多个 Startup 类的缓存文件夹,因为在我们的测试环境中,我需要在事情开始工作之前删除所有使用以前名称的旧 DLL.

My issue is that after this rename I can not get the Startup class to execute when I run this in IIS Express no matter what I try. I suspect there is some cached folder that contains multiple Startup class on my machine because in our test environment I needed to remove all the old DLLs that were using the previous name before things started working.

我知道 Startup 没有执行,因为我有断点没有触发(实际上没有启用,因为 VS 没有看到加载的符号):

I know Startup isn't executing because I have breakpoints in it that are not firing (and in fact are not enabled because VS doesn't see the symbols loaded):

这是我迄今为止尝试过的:

Here's what I've tried thus far:

  • 卸载 IIS Express 10.0(我的开发机器上有 VS 2015 RC),清除所有 IIS 文件夹,然后重新安装 IIS Express 8
  • 清除了我的开发机器上的所有临时 ASP.NET 文件夹
  • 清除我自己的解决方案中的所有 obj/bin 文件夹

就我而言,我在 Startup.cs 中使用以下内容指定 Startup 类:

In my case I'm specifying the Startup class using the following in my Startup.cs:

[程序集:OwinStartup(typeof(Startup))]

...但同样,在我尝试重命名解决方案和项目之前,这一切都很好.我不认为这是一个普遍的 IIS Express 问题,因为我可以在本地成功运行其他基于 OWIN 的解决方案(例如,我们的 IdentityServer3) 没有问题......尽管该解决方案不需要任何名称更改.

...but again, this all worked just fine before I tried to renaming the solution and projects. I don't think this is a general IIS Express problem either because I can successfully run other OWIN-based solutions locally (e.g., our implementation of IdentityServer3) without issues...although that solution didn't require any name changes.

使用 IIS Express 的其他方面是否会因更改解决方案或项目文件的名称而被绊倒?

Is there some other aspect of using IIS Express that might get tripped up by changing the name of a solution or project file?

作为参考,我已经检查了以下可能的原因(没有任何运气):- OwinStartup 不启动......为什么?- 缺少 OWIN 启动类- ASP.NET 临时文件清理- OwinStartup 未触发

For reference I have already examined the following possible causes (without any luck): - OwinStartup not Starting ... Why? - OWIN Startup Class Missing - ASP.NET Temporary files cleanup - OwinStartup not firing

推荐答案

虽然我无法完全解释为什么这解决了问题,但我能够通过将我的项目更改为构建来解决这个问题常规 bin/ 文件夹.

While I can't fully explain why this solves the issue, I was able to fix this by changing my projects to build to the regular bin/ folder.

我很抱歉在我最初的问题中没有提到这一点,因为我认为它不相关,但我之前已将我的 ASP.NET 项目更改为构建为 binDebugbinRelease 取决于配置.这似乎工作得很好,但是一旦我更改了项目名称,就会导致这个问题.

I apologize for not mentioning this in my original question, because I didn't think it was relevant, but I had previously changed my ASP.NET project to build to binDebug and binRelease depending on the configuration. This seemed to work just fine, but caused this issue once I changed the name of the projects.

这篇关于重命名 ASP.NET 项目文件后,无法让 OWIN 启动类在 IIS Express 中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆