我在控制器中作为可选参数:

GetPostalCodeLocation(string postalCode, string postalCodeExt, string place = "", string district = "")

如果在URL我没有把它区域工作,但在应用程序中生成此URL:

Url:"http://localhost:62814/Api/Address/PostalCodeLocation?postalCode=2415&postalCodeExt=021&place=&district=Leiria"

我无法控制URL(由平台定义)

可以在路由集 &place= 中忽略吗?谢谢

UPDATE 我有这个动作过滤器

Dictionary<string, string> logParameters = new Dictionary<string, string>();
            logParameters = new Dictionary<string, string>();
            actionContext.Request.Properties.Add(new KeyValuePair<string, object>("watch", watch));
            actionContext.Request.Properties.Add(new KeyValuePair<string, object>("action", actionName));

            //// Create integer parameter.
            foreach (var param in actionContext.ActionArguments)
            {
                if (param.Value == null)
                {
                    throw new Exception("Parameter " + param.Key + " cannot be null");
                }
                {
                    logParameters.Add(param.Key, param.Value.ToString());
                }
            }
            actionContext.Request.Properties.Add(new KeyValuePair<string, object>("logParameters", logParameters));
            base.OnActionExecuting(actionContext);