Asp.net mvc 5 未找到包含启动或[AssemblyName]的程序集。启动类

Asp.net mvc 5 未找到包含启动或[AssemblyName]的程序集。启动类,asp.net-mvc-5,asp.net-web-api2,startup,Asp.net Mvc 5,Asp.net Web Api2,Startup,我试着从其他和类似帖子的答案中解决这个问题,但没有成功。 我使用的是MVC5框架4.8最新版本VS2017 谢谢 我的配置是:(包括其他尝试) Api是: namespace Api.xxx { [Route("values")] public class ValuesController : ApiController { private static readonly Random _random = new Random(); pu

我试着从其他和类似帖子的答案中解决这个问题,但没有成功。
我使用的是MVC5框架4.8最新版本VS2017

谢谢

我的配置是:(包括其他尝试)

Api是:

namespace Api.xxx
{
    [Route("values")]
    public class ValuesController : ApiController
    {
        private static readonly Random _random = new Random();

        public IEnumerable<string> Get()
        {
            var random = new Random();
            return new[]
            {
                _random.Next(0, 10).ToString(),
                _random.Next(0, 10).ToString()
            };
        }
    }
}
namespace Api.xxx
{
[路线(“价值”)]
公共类值控制器:ApiController
{
私有静态只读随机_Random=new Random();
公共IEnumerable Get()
{
var random=新的random();
返回新的[]
{
_random.Next(0,10).ToString(),
_random.Next(0,10).ToString()
};
}
}
}

我想你需要改变

[程序集:OwinStartupAttribute(typeof(Api.xxx.Startup))]

[汇编:OwinStartup(typeof(Api.xxx.Startup))]


参考资料:

实际上两者都有效,…intellisense建议相同。我忘记了将这个项目添加到我的解决方案多项目设置中。但是谢谢你。这也是正确的,也是可以接受的。
[assembly: OwinStartupAttribute(typeof(Api.xxx.Startup))]
namespace Api.xxx
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Allow all origins
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            ….
        }
    }
}
namespace Api.xxx
{
    [Route("values")]
    public class ValuesController : ApiController
    {
        private static readonly Random _random = new Random();

        public IEnumerable<string> Get()
        {
            var random = new Random();
            return new[]
            {
                _random.Next(0, 10).ToString(),
                _random.Next(0, 10).ToString()
            };
        }
    }
}