嗨,祝你们圣诞快乐.
我正在使用Phonegap AngularJS应用程序.我正在尝试制作一个http Post但我返回404错误.我使用jquery 1.10.2尝试了POST,它可以工作.我已经好几天了,这是完成应用程序编码的最后一部分.
我尝试过不同版本的请求但没有成功.
这是代码
$scope.sendMail = function (user){
console.log('sendmaul');
$http.post('https://cloud/email.aspx',
{
user: user.email,
pass: user.password,
to:user.recipient,
subject:'Test',
message:'My Message'
}
)
.success(function (data, status, headers, config){
console.log('success');
})
.error(function (data,status,headers,config){
console.log(data + status + config);
});
}
Run Code Online (Sandbox Code Playgroud)
我已经在许多地方读过,我需要在angular.module上添加以下代码作为.config
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
Run Code Online (Sandbox Code Playgroud)
我在controller.js上添加了该代码,但我在应用程序中看不到行为上的差异.我也有很多http.get()请求工作得很好.
- 编辑 -
https://cloud.email.aspx不是真正的网站.
我正在尝试使用Web服务实现DocX以替换Sharepoint中文档库中的文档中的信息.我遇到了困难,因为当我运行我的项目并尝试将信息发送到api地址时,我收到以下错误
Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.
Run Code Online (Sandbox Code Playgroud)
在下一行调试代码时会中断
using (SPSite site = new SPSite(siteurl))
Run Code Online (Sandbox Code Playgroud)
我发现我需要在64位模式下运行该项目,但如果我选择该选项,项目就不会运行.我还发现无法检查选项Prefer 32bit但是该选项已禁用且未检查,最后在IIS应用程序池提前设置中我需要将其设置为true选项启用32位应用程序,但它没有做任何事情.
以前没有一个对我有用,我想请求帮助解决这个问题.
我正在开发Sharepoint 2013,Visual Studio 2012和MVC 4.
编辑 -
API函数
public class DocumentController : ApiController
{
public DocModel Get(string docId, string docName, string docLibrary, string newDocLibrary)
{
DocModel document = new DocModel();
try
{
string siteurl = "http://win-n1ni65gppp2/";
using (SPSite site = new SPSite(siteurl))
{
using (SPWeb web = site.OpenWeb())
{}
}
catch …Run Code Online (Sandbox Code Playgroud)