无法找到WCF .svc端点

时间:2010-10-30 02:41:20

标签: silverlight wcf

本地我运行Silverlight应用程序时没有任何问题。网站出现就好了。我们将代码部署到我们的测试环境中,我们的站点(或访问我们的数据)停止工作。我不认为我们的svc文件被识别。我倾向于关于端点的问题。我是wcf和服务引用的新手。下面是我们的webconfig代码和clientconfig的代码。想知道是否有人可以就我们的问题给出一些指示。

我们的web.config

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <customBinding>
      <binding name="AlgaeTrackerDataServices.customBinding0">
        <binaryMessageEncoding/>
        <httpTransport/>
      </binding>
    </customBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
         multipleSiteBindingsEnabled="true"/>
  <services>
     <service name="AlgaeTrackerDataServices">
        <endpoint address="" 
                  binding="customBinding" 
                  bindingConfiguration="AlgaeTrackerDataServices.customBinding0" 
                  contract="AlgaeTrackerDataServices">
        </endpoint>
        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange"/>
     </service>
   </services>
</system.serviceModel>

我们的客户端配置

 <system.serviceModel>
    <bindings>
        <customBinding>
            <binding name="CustomBinding_AlgaeTrackerDataServices">
                <binaryMessageEncoding />
                <httpTransport maxReceivedMessageSize="2147483647" 
                               maxBufferSize="2147483647" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:8080/AlgaeTrackerDataServices.svc"
                  binding="customBinding" 
                  bindingConfiguration="CustomBinding_AlgaeTrackerDataServices"
                  contract="AlgaeTrackerServices.AlgaeTrackerDataServices" 
                  name="CustomBinding_AlgaeTrackerDataServices" />
    </client>
</system.serviceModel>

本地......当我点击svc文件并在浏览器中查看时,它会很好,我可以查看wsdl。在我们的服务器上,我无法查看svc文件..

我收到一条错误,指出无法启动asp.net开发...端口8080正在使用中

我们的事件日志说明了这个......

  

WebHost无法处理请求。   发件人信息:   System.ServiceModel.Activation.HostedHttpRequestAsyncResult / 31852487   例外:System.Web.HttpException   (0x80004005):该服务   '/AlgaeTrackerDataServices.svc'可以   不存在。 ---&GT;   System.ServiceModel.EndpointNotFoundException:   服务   '/AlgaeTrackerDataServices.svc'可以   不存在。在   System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(字符串   normalizedVirtualPath)at   System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(字符串   relativeVirtualPath)at   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()   在   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()   在   System.Runtime.AsyncResult.End [TAsyncResult](IAsyncResult的   结果)在   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult的   结果)进程名称:w3wp进程   ID:13128

提前感谢您的帮助...

3 个答案:

答案 0 :(得分:2)

使用SVC文件和http传输将表明您可能在IIS中托管此WCF服务,对吧?

在这种情况下,服务的地址由以下人员确定:

  • 您的服务器名称
  • 您的服务器端口(可选)
  • 您的SVC文件包含在
  • 中的虚拟目录(及其可能的子目录)
  • *.SVC本身

因此,从“远程”客户端,地址通常类似于:

http://(servername)/(virtual directory name)/YourService.svc

在远程客户端上,您的服务将肯定不在localhost上 - 这将是客户端计算机本身。您需要使用具有该服务的服务器的服务器名称(或IP地址)。所以你需要做的(最有可能的)是调整客户端的配置来引用服务的服务器地址/ URL,而不是localhost。此外,除非您专门更改了IIS配置,否则您的服务将位于端口80上 - 而不是8080。

答案 1 :(得分:2)

修复是在端点部分添加相对路径。

而不是“http:// localhost:8080 / AlgaeTrackerDataServices.svc

这很有用

” ../ AlgaeTrackerDataServices.svc

答案 2 :(得分:0)

我实际上遇到了类似的问题,我的错误原因是虚拟目录位于与主网站节点上定义为“主目录”不同的子文件夹中。 E.g:

主目录c:\Inetpub\wwwroot

申请路径:c:\Apps\MyService

当我将MyService移至c:\Inetpub\wwwroot\MyService时,问题就消失了。

似乎有点奇怪,IIS要求您浏览服务的位置,实际上它必须是主目录中的子文件夹。