我只是一般的问题.如果我有一个调用SQL Server存储过程的C#应用程序,并且C#应用程序超时,那么服务器上的过程调用是否继续运行到它的完成?
我们开始将VB6 WMS应用程序转换为.NET,其中一部分将是手持式扫描仪(例如RF和条形码)MC9090.
微软在Visual Studio 2008之后是否放弃了对Compact Framework的支持?
有哪些选项可用于在此设备上进行开发?
因此,我正在为WebAPI应用程序整理一个概念验证原型,并且所有常用方法都很有效.但我也想证明能够通过WebAPI调用自定义方法.所以我在RouteConfig.cs中有以下路由:
routes.MapHttpRoute(
name: "ActionApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
在控制器中我有一个简单的方法:
[HttpGet]
public string Test()
{
return "this is a string";
}
Run Code Online (Sandbox Code Playgroud)
当我尝试调用我的方法时:http://localhost:43225/api/values/test我在浏览器中收到以下错误:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.String Get(Int32)' in 'WebAPI_Listener.Controllers.ValuesController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
</string>
Run Code Online (Sandbox Code Playgroud)
但是如果我在url的末尾指定了一个ID,比如http://localhost:43225/api/values/test/1它的工作原理,即使该方法本身根本没有参数.
所以在路由中,如果我将id设置为可选,为什么当我没有指定{id}时它不起作用,但是如果我这样做的话,它确实有效,即使该方法本身不期望{ ID}??