WCF:从脚本管理器问题引用服务

时间:2009-12-08 16:26:43

标签: wcf

我正在使用localhost:2971上的一个项目,并且在主页面中我想要将一个asp:ScriptReference包含到我在IIS中托管的wcf服务:5152

<Services>
      <asp:ServiceReference InlineScript="false" Path="http://localhost:5152/CostService.svc" />
</Services>

然后我试着打电话:

   var service = new SandwichServices.CostService();
    service.CostOfSandwiches(5, onSuccess);

在从母版页继承的页面上。

然而,在firefox错误控制台中,我得到以下内容:

Error: no element found
Source File: http://localhost:2971/CostService.svc/CostOfSandwiches
Line: 1

那么为什么源文件指向2971? 该服务在2152年创建的示例页面上正常工作。

任何人都知道什么? 任何帮助将不胜感激!

<!-- 
[EndpointNotFoundException]: The service '/CostService.svc' does not exist.
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
[HttpException]: The service '/CostService.svc' does not exist.
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)
   at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->

1 个答案:

答案 0 :(得分:0)

我认为您正在使用Cassini(Web Server Inside VS)进行开发。您需要两个Cassini实例才能访问您正在谈论的2个端口。如果是IIS,则不需要端口号。

相关问题