VS2013不能添加在溶液中WCF服务引用 [英] VS2013 cannot add WCF service reference in solution

查看:411
本文介绍了VS2013不能添加在溶液中WCF服务引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是creting一个默认就足以复制创建一个WCF网站.NET 3.5,我想。但它是defficult进行复制。我有VS2013与来自我的MSDN下载和我有Windows 8.1的所有更新。

I just created a WCF web site .net 3.5, I think by creting a default one would be enough to replicate. yet it is defficult to replicate. I have VS2013 with all updates as downloaded from my MSDN and I have windows 8.1.

我必须说,这在几个月前,我遇到的问题在一些机器,所以其他的heleped,我是假设它是一些与安装有关的,但现在却出现在3个不同的机器,一它们与Windows 8的所有64位。

I must say, that a few months ago I was having the issue in some machines, so the other ones heleped and I was assuming it was something related with the installation, but now it is appearing on 3 different machines, one of them with windows 8. all of them 64 bits.

这项服务是完全可以做到的,因为这是到现在为止我的交付和生产,这是工作顺利。

The service is perfectly done, since that was until now my deliverable and on production, it is working smooth.

现在我创建了一个基本的ASP.net aqlso .NET 3.5。并尝试添加服务引用,它会显示以下信息anfter不能添加。

Now I created a basic ASP.net aqlso .net 3.5. and tried to add the service reference and it shows the following message anfter failing to add it.

时出错下载   HTTP://本地主机:40226 / HabeasDataService.svc / _vti_bin / ListData.svc / $的元数据。   失败,HTTP状态404请求:未找到。   元数据包含了一个参考,不能解析:HTTP://本地主机:40226 / HabeasDataService.svc。 Ť   远程服务器返回了意外的响应:(405)不允许的方法。   远程服务器返回错误:(405)不允许的方法。   如果该服务在当前的解决方案定义,尝试构建解决方案,并再次添加服务引用。

There was an error downloading 'http:// localhost:40226/HabeasDataService.svc/_vti_bin/ListData.svc/$metadata'. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'http:// localhost:40226/HabeasDataService.svc'. T The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed. If the service is defined in the current solution, try building the solution and adding the service reference again.

当然,我并重建了clena,但问题仍然存在。

Of course I did the rebuild with a clena but the problem still persists.

该服务的配置如下

<system.serviceModel>
<services>
  <service behaviorConfiguration="ServicesLayer.Service1Behavior"
    name="ServicesLayer.Service1">
    <endpoint 
      bindingConfiguration="BigHttpBinding"
      name="BasicHttp"
      address="" 
      binding="basicHttpBinding" 
      contract="ServicesLayer.IHabeasDataService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServicesLayer.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding
      name="BigHttpBinding"
      maxBufferSize="65536"
      maxBufferPoolSize="65536"
      maxReceivedMessageSize="65536"
      transferMode="Buffered">
      <readerQuotas
        maxDepth="64"
        maxStringContentLength="65536"
        maxArrayLength="65536"
        maxBytesPerRead="4096"
        maxNameTableCharCount="32768"/>
    </binding>
  </basicHttpBinding>
</bindings>
</system.serviceModel>

我注意到了有关该行:

I noticed about this line:

<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true"/>

和尝试这两种配置,还是同样的错误。

and try both configurations and still the same mistake.

当我尝试通过单击视图在浏览器中我得到了404.17的错误是这样运行的SVC文件。

When I try running the svc file by clicking view in browser I get a 404.17 error like this.

这是非常令人沮丧,因为它完全摊位发展。

It is very frustrating because it completely stalls development.

注意 一切有关IIS可能是有用的,但记住这是IIS防爆preSS。切换到本地IIS不管怎么说,还是失败了,但正如我所说。在生产服务器是薄荷

NOTE Everything related to IIS may be useful but remember it is IIS Express. Switching to local IIS anyway, still fails, but as I stated. On production server it is mint

推荐答案

我已经看到了这个问题==> ListData.svc的关键是在这里==>使用不正确的数据契约属性的集合类时。

I have seen this problem ==> ListData.svc is the key here ==> when using an incorrect data contract attribute for a collection class.

不正确的:

[DataContract]
public class MyClassList : List<MyClass>
{
}

正确的:

[CollectionDataContract]
public class MyClassList : List<MyClass>
{
}

这篇关于VS2013不能添加在溶液中WCF服务引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆