1

我做了一个“Hello World”WCF 服务。该服务没有 svc 文件。因此,web.config 文件确定其地址和其他设置。

但是,我坚持打开特定页面。当我运行 WCF 服务项目时,它总是显示错误页面(HTTP 错误 403.14)。这是因为浏览器尝试访问localhost而不是localhost/HelloWorldService.svc

你知道我该如何解决吗?

当我开始在 VS 2012 中运行 WCF 服务时,我想打开 localhost/HelloWorldService.svc。

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  <a href="http://go.microsoft.com/fwlink/?LinkId=169433">http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="false" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment >
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory"
         relativeAddress="HelloWorldService.svc"
         service="HelloWorldService.HelloWorldService"/>
      </serviceActivations>
    </serviceHostingEnvironment>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
4

1 回答 1

1

转到属性 -> Web -> 单击特定页面并输入/HelloWorldService.svc.

于 2013-05-07T18:28:43.973 回答