Can't get the OWIN Startup class to run in IIS Express after renaming ASP.NET project file

情到浓时终转凉″ 提交于 2019-11-26 22:12:37

问题


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. The solution builds fine and all my unit tests run sucessfully both locally and on our TeamCity build server
  2. The application runs fine on our test server (full IIS 8) and in production (also full IIS 8)

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.

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:

  • Uninstalled IIS Express 10.0 (I have VS 2015 RC on my dev machine), clean out all IIS folders, then re-installed IIS Express 8
  • Cleaned out all temp ASP.NET folders on my dev machine
  • Cleaned out all obj/bin folders within my own solution

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

[assembly: OwinStartup(typeof(Startup))]

...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.

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

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


回答1:


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.

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 bin\Debug and bin\Release depending on the configuration. This seemed to work just fine, but caused this issue once I changed the name of the projects.




回答2:


I know this is old, but just wanted to add that I ran across this using a custom template. In my case I had a working solution with a startup, made it a template but the template didn't work.

Come to find out, it was because the new project had a space in its name. So adding

[assembly: OwinStartup(typeof(myProjectName.Startup))]

to my existing startup file fixed it.



来源:https://stackoverflow.com/questions/30242581/cant-get-the-owin-startup-class-to-run-in-iis-express-after-renaming-asp-net-pr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!