【发布时间】:2011-06-28 17:28:28
【问题描述】:
我在我的应用程序中使用 ASMX 服务,并希望它指向特定的 Web 服务 URL。
我定义如下:
string serviceUrl = SPContext.Current.Web.Url + "/_vti_bin/MyService.asmx";
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
if (scriptManager != null) scriptManager.Services.Add(new ServiceReference(serviceUrl));
else
{
scriptManager = new ScriptManager();
scriptManager.Services.Add(new ServiceReference(serviceUrl));
Page.Form.Controls.Add(scriptManager);
}
这里SPContext.Current.Web.Url ==> http://mysite/mysubsite
但是当我像下面这样从 Javascript 调用服务时,Firebug 中的主机标头检查表明 Javascript 代理实际上正在调用服务:http://mysite/_vti_bin/MyService.asmx/Execute
MyWorkCore.API.Execute("GetData", dataXml, function (response) {
// doing something here
});
【问题讨论】:
-
我不知道这是否是您的问题的原因,但我相信您可能指向错误的 asmx 位置。 “_vti_bin”文件夹是frontpage 扩展创建的文件夹。 asmx 文件应位于站点的根目录或网站根目录内的文件夹结构中。它不应驻留在 bin 或“_vti_bin”中。
-
@Alex Mendez:所有 SharePoint 服务都驻留在 _vti_bin 中
-
我从未使用过sharepoint,所以不知道这一点。谢谢(你的)信息。此刻,我想不出别的了。
标签: c# .net web-services sharepoint asmx