繁体   English   中英

无法找到WCF .svc端点

[英]Can't Find WCF .svc Endpoints

本地我运行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'不存在。 ---> System.ServiceModel.EndpointNotFoundException:服务'/AlgaeTrackerDataServices.svc'不存在。 位于System.ServiceModel.Ac响应的System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)的System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)的System.Runtime.AsyncResult.End [TAsyncResult](IAsyncResult结果)进程名称:w3wp进程ID:13128

先谢谢您的帮助...

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

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

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

因此,从“远程”客户端,地址通常看起来像:

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

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

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

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

这很有效

” ../AlgaeTrackerDataServices.svc

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

主目录c:\\Inetpub\\wwwroot

应用程序路径: c:\\Apps\\MyService

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM