- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在我的 Angular 服务上使用 asp.net、mvc6 和 angularjs 开发应用程序。当我向操作方法发出请求时,我没有收到任何传递的数据。当我检查请求时,我可以看到由以下原因引起的异常:
- Form '((Microsoft.AspNet.Http.Internal.DefaultHttpRequest)this.Request).Form' threw an exception of type 'System.InvalidOperationException' Microsoft.AspNet.Http.IFormCollection {System.InvalidOperationException}
异常消息说 "Incorrect Content-Type:application/json;charset=UTF-8"
我的 angular.service
return $http({ method: 'POST', url: 'home/createEvent', eventDetails: event })
.success(function(data, status, headers, config) {
return data;
})
.catch(function(data, status, headers, config) {
console.log(data);
});
在我的 Controller 上
[HttpPost]
public IActionResult CreateEvent([FromBody]Event eventDetails)
{
return Json(new {dsd=""},
new JsonSerializerSettings {ContractResolver = new CamelCasePropertyNamesContractResolver()});
}
最佳答案
接受的答案对我不起作用。对我来说,解决方案是向 $http 调用添加 header :
$http({
url: "/install",
method: "POST",
data: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
})
.success(...);
关于c# - "Incorrect Content-Type: "异常抛出 Angular mvc 6 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33711629/
我正在使用带有 64 位插件的 64 位操作系统 Windows 7 终极机器 VS2008。 我已经在 32 位和 64 位、调试和发布配置中成功构建了我的项目。64 位调试未启动;它给出了错误:
我遇到了一个我不理解的 java 泛型编译时错误。 我有两种方法: public static final T doStuff(List list, int k, Comparator compar
在下面的类(class)中,我尝试打印工资系统中员工的详细信息。请注意,Porter、Pharmacist 和 Surgeon 均继承自 Employee。 但是,它只是重复打印添加到数组中的第一个员
package chapter5; import java.util.Scanner; public class Exercise5 { public static void main(Str
WITH list_dedup (Company, duplicate_count) AS ( SELECT *, ROW_NUMBER() OVER (
我有一些 base64 编码的数据,即使其中存在填充错误,我也想将其转换回二进制。如果我使用 base64.decodestring(b64_string) 它会引发“不正确的填充”错误。还有其他方法
我正在致力于将大型 Delphi 代码库调整为 64 位。在许多情况下,有些行将指针转换为 32 位值或从 32 位值转换为类似于以下内容的行: var p1,p2 : pointer; begi
我正在尝试在 rtaudio 中生成一个简单的正弦波,以验证我了解发生了什么。但是,结果是错误的。 我有一个全局float timec ,以及使用 openStream 调用的回调它应该用样本填充缓冲
将我们的 Jenkins 主安装更新到最新的 LTS 版本 2.46.3 后,其从属设备之一(Windows 7 计算机,32 位)无法与主设备连接。 我们收到的错误是: java -jar slav
实现ROCR曲线,kNN,K进行10倍交叉验证。 我正在使用电离层数据集。 这是属性信息,供您引用: -如上所述,所有34个都是连续的 -根据定义,第35个属性为“好”或“坏” 以上总结。这是一个二进
我正在阅读有关“Servlet 3.0 中的异步处理支持”的专家(?)教程(http://www.javaworld.com/javaworld/jw-02-2009/jw-02-servlet3.h
我目前正在为我即将开展的项目制作自己的关卡创建器(图 block map )。一切都很顺利,只是当我添加放大和缩小选项时遇到了问题。我有一个类正在处理当前的所有输入和渲染,因为我刚刚开始。 Level
我在 Eclipse mars 2.0 中使用 Mockito(1.10.19) 进行 Java EE 测试来测试离线存储库。此类依赖于 InitialData 类来检索信息。 我的第一个任务是将地址
我正在尝试实现“算法简介”一书中所述的合并排序算法。尽管实现是按照书中指定的,但输出不正确。很有可能出现相差一的错误,但我无法指出它。有什么指点吗? #include #include #defi
我正在尝试确定 Windows 任务栏(系统托盘?)停靠在哪一侧 - 这样我就可以将弹出窗口定位在任务栏的上方/下方/左侧/右侧。 我正在使用 SHAppBarMessage(ABM_QUERYPOS
我正在使用以下公式实现 DCT 变换: 但是结果不正确。对于一些 8 × 8 矩阵, 0 0 0 0 0 0 0 0 210 210 210 210 210 210 21
我正在尝试编写将内存流转换为 png 图像的代码,但在 using(Image img = Image.从流(毫秒))。它没有进一步指定它,所以我不知道为什么会收到错误以及我应该怎么做。 此外,如何将
这个语句工作正常: SELECT * FROM table_name WHERE DATE(date_event) < DATE(NOW() - INTERVAL 90 DAY); 在 DELETE
当我删除图像并尝试保存配置文件时,它显示错误“incorect padding” 我的代码是 模型.py import webcam.admin from webcam import widgets
我正在尝试创建一个函数来计算两个字符串之间的汉明距离。当我调用这个函数时,它应该告诉我两个字符串之间不匹配的字符数。 我的输出不正确。我不断得到随机数结果。下面是我的代码: using namespa
我是一名优秀的程序员,十分优秀!