qin*_*126 2 visual-studio asp.net-core-mvc
我正在使用visual studio 2015并使用mvc core创建了一个空白的mvc应用程序.
在startup.cs文件中,我添加了一个新的测试方法.然后我将它附加到hello world字符串.如果我只是运行它,一切正常.我得到了"Hello World!3".但如果我尝试调试我的代码.我在测试方法中设置了几个断点.当我移动鼠标移动器那些a,b,c变量时.我一直得到":错误CS0103:当前上下文中不存在名称'xxxx'".这发生在今天.我创建了这个全新的应用程序,除了这个简单的方法之外什么都没有.
这是我到目前为止所做的.重启visual studio,重置所有设置.但仍然得到相同的错误消息.我认为它是视觉工作室.
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
int d = test();
app.UseIISPlatformHandler();
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!" + d.ToString());
});
}
private int test()
{
var a = 1;
var b = 2;
var c = a + b;
return c;
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1657 次 |
| 最近记录: |