我有以下路线:
context.MapRoute
(
"PersonArea_tripleInt",
"PersonArea/{controller}/{action}/{int1}/{int2}/{int3}",
new { controller = "Person", action = "Index" }, new { int1 = new IntConstraint(), int2 = new IntConstraint(), int3 = new IntConstraint() }
);
Run Code Online (Sandbox Code Playgroud)
我在我的控制器中使用这样的:
RoleListUrl = Url.Action("RoleList", "Person", new { Area = "PersonArea" }),
Run Code Online (Sandbox Code Playgroud)
要生成此URL:"/ PersonArea/Person/RoleList"
在我看来,我有下拉列表,将填充int1,int2和int3值.我在客户端使用JavaScript来填写URL的其余部分:
"/ PersonArea /人/的RoleList/12 /76分之43"
这是第一次工作得很好,但是当页面重新加载时,在我的控制器中创建基本URL时会重新使用旧值(12,43,76).因此,当用户与下拉列表交互时,会在客户端上创建以下URL:
"/ PersonArea /人/的RoleList/12/43 /88分之76/78分之154"
如何让Url.Action在服务器的后续帖子中忽略旧值(12,43,76),以便客户端可以构造正确的URL?我正在使用硬编码控制器中的基本URL("/ PersonArea/Person/RoleList /").
我只希望控制器每次都生成"/ PersonArea/Person/RoleList",让客户端填写其余的参数.
我错过了什么?谢谢.
我在webconfig中打开了自定义错误并重定向到"/ Error/Trouble".这是按设计工作的.Elmah正在记录错误.错误视图也在显示.
问题是我想检查我的Error控制器的Trouble操作中的抛出错误.当抛出错误时,在MVC将您重定向到自定义错误处理程序后,如何访问它?
如果CurrentUser为null,我会抛出异常:
if (CurrentUser == null)
{
var message = String.Format("{0} is not known. Please contact your administrator.", context.HttpContext.User.Identity.Name);
throw new Exception(message, new Exception("Inner Exception"));
}
Run Code Online (Sandbox Code Playgroud)
我希望能够在我的自定义错误处理程序("错误/故障")中访问它.你如何访问例外?
这是我的麻烦行动:
public ActionResult Trouble()
{
return View("Error");
}
Run Code Online (Sandbox Code Playgroud)
这是我的观点:
@model System.Web.Mvc.HandleErrorInfo
<h2>
Sorry, an error occurred while processing your request.
</h2>
@if (Model != null)
{
<p>@Model.Exception.Message</p>
<p>@Model.Exception.GetType().Name<br />
thrown in @Model.ControllerName @Model.ActionName</p>
<p>Error Details:</p>
<p>@Model.Exception.Message</p>
}
Run Code Online (Sandbox Code Playgroud)
System.Web.Mvc.HandleErrorInfo是我的Trouble视图的模型,它是空的.谢谢你的帮助.
是否有Visual Studio 2012插件可以为jQuery Mobile数据属性提供智能感知?
我正在使用Phonegap Developer App将我的应用程序加载到设备上进行测试.在命令行中运行phonegap服务时,我得到以下内容:
[phonegap]启动应用服务器... [phonegap]监听192.168.1.210:3000 [phonegap] [phonegap] ctrl-c停止服务器[phonegap]
我们被要求在Phonegap开发者应用程序中输入192.168.1.210:3000,以便在我们的不同设备上加载应用程序.
如何自定义192.168.1.210:3000值?
我正在寻找一个 C# 库,它将根据给定的 JSON 模式生成一个有效的 JSON 对象。我想生成一个非常简单的 JSON 示例,就像Swagger 的做法一样:
我见过一些 JavaScript 库,如JSON Schema Faker,但我需要一个 C#/.Net 库,我可以在我的后端代码中生成示例 JSON。
我正在为我的 Angular 7 应用程序运行 Webpack Bundle Analyzer,它产生如下输出:
根据此处的故障排除部分使用 webpack.optimize.ModuleConcatenationPlugin 时,这是一个已知的警告。他们对 Angular CLI < 6 提出了建议。我也在这里找到了建议注释掉 ModuleConcatenationPlugin 的建议,但是,它没有确定应该在哪里注释掉。
您知道如何修复为 Angular CLI 7.1.0 连接的模块吗?谢谢你的时间。
webpack angular webpack-bundle-analyzer angular7 angular-cli-v7
我有一个 Angular/Apollo GraphQL 实现,它基于 GraphQl 端点生成打字稿代码,该端点呈现模式。我可以通过 Postman 使用查询访问端点并返回结果。但是,当我通过 npm 运行“graphql-codegen --config codegen.yml”时,出现此错误:
“错误:必须提供查询根类型”
服务器端是使用 GraphQL ASPNetCore 的 .Net Core 实现。我定义了 4 个不同的查询,每个查询都通过 graphiql 工作。
关于为什么查询根类型现在被返回为空的任何想法?
我正在尝试使用无服务器框架将 Node.js 应用程序部署到 Lambda,但是,我的 Node 代码使用 tsconfig.json 中的路径来引用导入,但无服务器部署过程失败。如何连接 serverless.yml 来确认并使用 tsconfig.json 中定义的路径?
我已经安装了 serverless-plugin-typescript,但它似乎无法识别 tsconfig 中的路径。
无服务器.yml
service:
name: app-name
custom:
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
plugins:
- serverless-webpack
- serverless-plugin-typescript
...
Run Code Online (Sandbox Code Playgroud)
tsconfig.ts
{
"compileOnSave": true,
"compilerOptions": {
"lib": [
"es2017"
],
"baseUrl": "./src",
"declaration": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "./dist",
"paths": {
"@config/*": [
"config/*"
],
"@core/*": [
"core/*"
],
"@infra/*": [
"infra/*"
],
"@modules/*": [
"modules/*"
], …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 jQuery Mobile 1.3.2 实现面板功能。这是我的代码:
<div data-role="page" id="homePage">
<section data-role="panel" class="row">
PANEL HERE..
</section>
<section data-role="header" class="row">
<div class="large-12 columns">
<h3>
Header..
</h3>
</div>
</section>
<section data-role="content" class="row">
<div class="large-12 columns">
CONTENT..
</div>
</section>
<section data-role="footer" class="row">
<div class="large-12 columns">
FOOTER..
</div>
</section>
<script type="text/javascript">
$(function ()
{
}());
</script>
</div>
Run Code Online (Sandbox Code Playgroud)
当我运行这是浏览器时,出现错误:
$.data(...) 未定义
我已经将它追溯到 jquery.mobile-1.3.2.js 的第 10330 行:
var $theme = $.data( page[0], "mobilePage" ).options.theme,
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
如果在 3 次尝试后收集不成功,我需要重试一系列 RxJS observables 并抛出序列中项目的错误对象。我发现了这个例子(处理错误的增量退避策略):
var source = get('url').retryWhen(
attempts =>
attempts
.zip(Observable.range(1, 3), (_, i) => i)
.flatMap(i => {
console.log('delay retry by ' + i + ' second(s)');
return Rx.Observable.timer(i * 1000);
});
);
var subscription = source.subscribe(
data => {
// Displays the data from the URL or cached data
console.log(data);
});
Run Code Online (Sandbox Code Playgroud)
你如何抛出属于集合中项目的错误?上面的代码似乎吞下了错误,而不是将其呈现给调用者来处理。
android ×1
angular ×1
angular7 ×1
apollo ×1
asp.net-mvc ×1
aws-lambda ×1
cordova ×1
graphql ×1
intellisense ×1
ios ×1
json.net ×1
jsonschema ×1
node.js ×1
rxjs ×1
rxjs5 ×1
swagger ×1
webpack ×1