设置svc-less WCF服务的默认页面

时间:2013-05-07 16:58:17

标签: wcf

我制作了'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>

1 个答案:

答案 0 :(得分:1)

转到属性 - &gt;网络 - &gt;单击特定页面并输入/HelloWorldService.svc

相关问题