【发布时间】:2009-09-23 20:04:38
【问题描述】:
我正在尝试使用 asp.net2.0 使用 WCF 服务
这里有一些细节:
1) WCF 服务托管在不同的服务器 IIS 上
网址:http://myserver/Service.svc
2) Web.config
bindings>
wsHttpBinding>
binding name="ServiceBinding" maxReceivedMessageSize="2147483647"
readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/
/binding>
/wsHttpBinding>
/bindings>
services>
service name="MYNameSpace.Service" behaviorConfiguration="ServiceBehavior"
endpoint name="ServiceEndPoint" address="http://myserver/Service.svc" binding="wsHttpBinding" bindingConfiguration="ServiceBinding" contract="MyNameSpace.IService"/
/service
3) asp.net 页面
asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
Services
asp:ServiceReference Path="~/Service.svc" /
/Services
Scripts
asp:ScriptReference Path="~/myjs.js" /
/Scripts
/asp:ScriptManager
4) myjs.js
MYNameSpace.IService.MyMethod();
*** 这里会抛出“MyNameSpace”未定义的错误。
在我的本地机器上一切正常。 当我尝试从 asp.net2.0 应用程序消费时出现问题
我们将不胜感激。
提前致谢
【问题讨论】:
-
尝试重新表述您的问题。真的不清楚你想达到什么目的。
-
编辑器在我粘贴的代码中没有使用 '
-
使用javascript从asp.net2.0(工作机器)调用IIS托管的WCF(不同机器)服务。
-
1 0 1 0 1 0 图标允许您粘贴代码。尝试将其与您的代码一起使用。无论如何,您如何尝试调用 WCF?使用像 MS AJAX 或 jQuery 这样的 javascript 库?
标签: asp.net wcf web-services