简体   繁体   English

从 http 访问 WCF 服务时出现 500 内部服务器错误并且由于相同原因无法添加服务引用

[英]500 Internal Server error while accessing WCF service from http and unable to add service reference for the same reason

I am trying to access my WCF service that resides on a sub-domain on my website.我正在尝试访问驻留在我网站子域中的 WCF 服务。 The properties of server on which sub-domain is situated is as follows:子域所在服务器的属性如下:

  • It has basic authentication它具有基本身份验证
  • It has 4.0 .NET version它有 4.0 .NET 版本

But the problem is, when I try to access the service like http://mysubdomain.mydomain.com/Service1.svc it gives me但问题是,当我尝试访问像http://mysubdomain.mydomain.com/Service1.svc这样的服务时,它给了我

500 - Internal server error. 500 - 内部服务器错误。

Although it is working fine from localhost.虽然它在本地主机上运行良好。 I also changed the properties in the web.config as:我还将 web.config 中的属性更改为:

<services>
      <service behaviorConfiguration="WCFService.Service1Behavior"
        name="WCFService.WrangleCore">
        <endpoint address="http://mysubdomain.mydomain.com/ServiceCore.svc" binding="basicHttpBinding" contract="WCFService.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="WCFService.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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

Please tell me the solution to this.请告诉我解决这个问题的方法。

It is worth checking if your DNS suffixes are correctly configured.值得检查您的 DNS 后缀是否配置正确。 I have seen it to due to a silly spelling mistake as well!由于一个愚蠢的拼写错误,我也看到了它!

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

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