我的应用程序是ASP.NET Core 1.0 Web API.如果我的控制器返回一个小字符串,一切正常.但是如果字符串长度超过32768,我收到以下错误消息:
--- End of stack trace previous location where exception was thrown ---
at System.Runtime.CompillerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompillerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Htpp.Frame`1.<RequestProcessAsync>d__2.MoveNext()
Request Information
RequestID:440ed7db-0002-006f-742e-a28f82000000
RequestDate:Tue, 21 Mar 2017 11:30:40 GMT
StatusMessage:Bad Request
ErrorCode:PropertyValueTooLarge
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
[HttpGet]
[Produces("plain/text")]
public async Task<IActionResult> GetData()
{
return this.Ok(this.GetResponse());
}
private string GetResponse()
{
string retVal = string.Empty;
for (int i = 0; i < 32769; i++)
{
retVal = retVal + "a";
}
return retVal;
}
Run Code Online (Sandbox Code Playgroud)
完整的错误消息:
Microsoft.WindowsAzure.Storage.StorageException: BadRequest
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.<ExecuteAsyncInternal>d__4`1.MoveNext() …Run Code Online (Sandbox Code Playgroud) 我的应用程序是ASP.NET Core 1.0 Web API。
我有以下控制器:
[HttpGet("{someData:MinLength(5):MaxLength(5)}")]
[Produces("application/json")]
public async Task<IActionResult> GetSomeData(string someData)
{
return this.Ok(JsonConvert.SerializeObject("Data is: " + someData));
}
Run Code Online (Sandbox Code Playgroud)
例如,每当我传递字符串“ 111”时,sagger就会向我显示以下消息:
我如何获得一个响应机构,例如:
“请输入5个数字”
谢谢
官方的MS文档说,如果我想在Linux上托管ASP.NET核心应用程序,则应该在其前面放置一个apache或nginx反向代理。但是,我找不到我应该这样做的任何理由。
我为什么要那样做?为什么不能仅在茶est上运行?为什么需要反向代理?
我有以下代码段:
JPanel panel = new JPanel(new GridBagLayout());
Run Code Online (Sandbox Code Playgroud)
我想检查一下,我的面板是否已GridBagLayout分配给它。我让它像这样工作:
if(panel.getLayout().getClass() == GridBagLayout.class) {
// seems to work
}
Run Code Online (Sandbox Code Playgroud)
虽然它有效,但它有点hacky,因为我不想为此使用反射。
还有其他方法可以检查分配的布局吗?
我有一个Button我想放在我的 BorderPane 底部并将其居中。我想用FXML.
这是我的 BorderPane 的底部:
<bottom>
<Button>
<text>
Center this button
</text>
</Button>
</bottom>
Run Code Online (Sandbox Code Playgroud)
完整FXML(不含进口):
<BorderPane id="BorderPane" xmlns:fx="http://javafx.com/fxml/1">
<top>
<HBox>
<BorderPane.margin>
<Insets left="15" right="15" top="15"/>
</BorderPane.margin>
<spacing>
5
</spacing>
<Label>
<padding>
<Insets top="5" right="5"/>
</padding>
<text>
Y-Axis:
</text>
</Label>
<TextField>
<text>
10
</text>
</TextField>
<Label>
<padding>
<Insets top="5" left="15" right="5"/>
</padding>
<text>
X-Axis:
</text>
</Label>
<TextField>
<text>
10
</text>
</TextField>
</HBox>
</top>
<bottom>
<Button>
<text>
Center this button
</text>
</Button>
</bottom>
Run Code Online (Sandbox Code Playgroud)
结果:
是否有任何标签可以使用 …