我正在从Nancy 1.4.5 -> 2.0升级我的项目
我有错误:
public class AppBootstrapper : AutofacNancyBootstrapper
{
private readonly ILifetimeScope _scope;
public AppBootstrapper(ILifetimeScope scope)
{
_scope = scope;
}
protected override ILifetimeScope GetApplicationContainer()
{
return _scope;
}
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines)
{
JsonSettings.MaxJsonLength = int.MaxValue;
JsonSettings.RetainCasing = true;
base.ApplicationStartup(container, pipelines);
}
}}
Error CS0103 The name 'JsonSettings' does not exist in the current context
如何解决此问题?
发布于 2019-07-26 03:13:19
我在AppBootstrapper类中添加了方法:
public class AppBootstrapper : DefaultNancyBootstrapper
{
public override void Configure(INancyEnvironment environment)
{
environment.Json(retainCasing: true);
}
... other methods
}并在web.config中添加了maxJsonLength
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647"/>
</webServices>
</scripting>
</system.web.extensions>https://stackoverflow.com/questions/57207890
复制相似问题