Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# OData函数参数类型双精度_C#_Asp.net_Asp.net Web Api_Odata - Fatal编程技术网

C# OData函数参数类型双精度

C# OData函数参数类型双精度,c#,asp.net,asp.net-web-api,odata,C#,Asp.net,Asp.net Web Api,Odata,我创建了一个函数,它的参数为int,int,double: var functionUnitConvertDouble = builder.Function("Convert"); functionUnitConvertDouble.Parameter<int>("From"); functionUnitConvertDouble.Parameter<int>("To"); functionUnitConvertDouble.Parameter<double>

我创建了一个函数,它的参数为
int,int,double

var functionUnitConvertDouble = builder.Function("Convert");
functionUnitConvertDouble.Parameter<int>("From");
functionUnitConvertDouble.Parameter<int>("To");
functionUnitConvertDouble.Parameter<double>("Value");
functionUnitConvertDouble.Returns<double[]>();
函数是正常的,我可以调用这个URL,它工作正常

http://localhost:63911/odata/Convert(From=4,To=2,Value=20)
但是,我的最后一个参数是double,当我尝试传递double参数时,它不起作用(我收到一条错误消息,如“endpoint not exist”),例如:

http://localhost:63911/odata/Convert(From=4,To=2,Value=20.5)

由于double包含点,而IIS处理点的方式很奇怪(如果它是一个字符串作为参数,则是相同的),请将其添加到web.congfig中

<system.webServer>
    <!--You might have more stuff here-->

    <modules>
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
    </modules>
</system.webServer>

您是否能够解决此问题?我也有同样的错误。
<system.webServer>
    <!--You might have more stuff here-->

    <modules>
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
    </modules>
</system.webServer>