【发布时间】:2019-12-09 15:16:17
【问题描述】:
我想将数据发送到后端,以便使用带有 API URL 的 http post 方法创建有关客户的详细信息。但它拒绝连接后端。因为它需要一些权限才能访问 post 方法。请给出一些指导方针并解决此错误。
我已经在 app.setting 中对后端的 Allow-permission-* 进行了一些更改。但什么也没发生。
//This is my ts code
this.http.post('http://localhost:2401/api/CustomerAPI',
jstring).map(res => res.json()).subscribe(data => {
console.log(data)
}, (err) => {
console.log(err)
});
}
从源“http://localhost:8100”访问“http://localhost:2401/api/CustomerAPI”处的 XMLHttpRequest 已被 CORS 策略阻止:请求的资源上不存在“Access-Control-Allow-Origin”标头。
然后它也显示Failed to load resource: net::ERR_CONNECTION_REFUSED
【问题讨论】:
-
能否提供 CustomerAPI 邮政编码
-
var jstring = JSON.stringify({ CodeId: this.Code, customerNameId: this.CustomerName, ProjectnameId: this.Projectname, SortcodeId: this.Sortcode, contactId: this.contact, AddressId: this.地址,Address2Id:this.Address2,CountryId:this.Country,PostalcodeId:this.Postalcode,PhoneId:this.Phone,FaxId:this.Fax,CheckeboxId:this.Checkebox,DescriptionId:this.Description
-
我想在“appsettings.json”的后端做一些访问权限
标签: angular sqlite asp.net-core asp.net-web-api ionic3