简体   繁体   中英

Displaying web page when running WCF service

I have a WCF service that operates on a database. When running this project in Visual Studio, a browser page opens that simply shows the project's file structure.

I have an HTML file that displays a user interface for the service. How can I make it so that this file is automatically displayed in the browser when running the project? Thanks in advance!

右键单击项目浏览器中的HTML文件,然后选择“设置为起始页”。它将在运行项目时显示。

The other answers will do the trick. If you want your file to be displayed without having to redirect to the actual file, you can do the following.

Add this to your WCF service's web.config:

<system.webServer>
<defaultDocument enabled="true">
  <files>
    <clear />
    <add value="Index.html" />
  </files>
</defaultDocument>
</system.webserver>

Index.html will now be automatically loaded when running the project.

在项目属性-> Web-> StartAction->选择“特定页面”,并指定要显示的页面,而不是默认服务视图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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