我有一个通过提琴手的http post请求:使用
http://localhost:58183/api/Account/Register
与身体
{"email":"jbjunk4@outlook.com","password":"Abc1231*","confirmPassword":"Abc1231*"}
这执行得很好,并且电子邮件已在 webapi 2 的身份数据库中注册。
但是,我的 authorize.service.ts 中有以下代码:
registerUser(localUser: LocalUser) {
var headers = new Headers();
headers.append('Content-Type', this.constants.jsonContentType);
var creds = JSON.stringify(localUser);
console.log(creds);
console.log(this.constants.accountUrl + "Register");
return this.http.post(this.constants.accountUrl + "Register", creds, { headers: headers })
.map(res => res.json());
}
creds =
{"email":"jbaird9@arsbirder.com","password":"Abc1231*","confirmPassword":"Abc1231*"}
url = http://localhost:58183/api/Account/Register
json-contentType = "application/json;charset=UTF-8";
控制台显示: SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
主页 HTML1300:发生导航。主页 模板解析警告:该元素已弃用。改用 ("-child ui-shadow':!root}" class="ui-menu-list" (click)="listClick($event)"> [WARNING ->] http://localhost:58183/api /Account/Register authorization.service.ts (47,9) SCRIPT7002:XMLHttpRequest:网络错误 0x80070005,访问被拒绝。
home ERROR SyntaxError: Invalid character core.es5.js (1020,1) "ERROR" { [functions]: , proto : { }, description: "Invalid character", message: "Invalid character", name: "SyntaxError",编号:-2146827274,堆栈:“SyntaxError:SafeSubscriber.prototype.__tryOrUnsub ( http://localhost:4200/vendor ) 的匿名函数 ( http://localhost:4200/main.bundle.js:788:13 ) 中的无效字符.bundle.js:37370:13 ) 在 SafeSubscriber.prototype.error ( http://localhost:4200/vendor.bundle.js:37329:21 ) 在 Subscriber.prototype._error ( http://localhost:4200/vendor .bundle.js:37260:9 ) 在 Subscriber.prototype.error (http://localhost:4200/vendor.bundle.js:37234:13 ) 在 Subscriber.prototype._error ( http://localhost:4200/vendor.bundle.js:37260:9 ) 在 Subscriber.prototype.error ( http://localhost:4200/vendor.bundle.js:37234:13 ) onError ( http://localhost:4200/vendor.bundle.js:108672:17 ) 在 ZoneDelegate.prototype.invokeTask ( http:// localhost:4200/polyfills.bundle.js:2836:13 ) 在 onInvokeTask ( http://localhost:4200/vendor.bundle.js:90272:21 )" }
HTTP405: BAD METHOD - 不支持使用的 HTTP 动词。(XHR) 选项 - http://localhost:58183/api/Account/Register
我想不通。提前感谢您的帮助。