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>