我可以使用独立的WCF Web服务更改错误页面(404)吗?

时间:2021-07-17 20:29:03

I have a standalone (non-IIS) WCF service that - besides the services - provides some simple HTML pages via a WebServiceHost.

我有一个独立的(非IIS)WCF服务 - 除了服务 - 通过WebServiceHost提供一些简单的HTML页面。

When I enter http://localhost:1234/SomeRandomWords as an URL into the browser I get a default error page that says

当我在浏览器中输入http:// localhost:1234 / SomeRandomWords作为URL时,我得到一个默认的错误页面

Dienst

Es wurde kein Endpunkt gefunden

Es wurde kein Endpunkt gefunden

(Translated to english: Service / Endpoint not found)

(翻译成英文:未找到服务/端点)

Can I override this error page to provide some more info? I'd like to provide a list to the user with my HTML endpoint and the endpoints of the several web services available via my service.

我可以覆盖此错误页面以提供更多信息吗?我想用我的HTML端点向用户提供一个列表,以及通过我的服务提供的几个Web服务的端点。

1 个解决方案

#1


You cant in W32 Service Host. You can in IIS Host.

你不能在W32服务主机。您可以在IIS主机中。

You cant change the default WCF endpoint error message because your code is not yet executed.

您无法更改默认的WCF端点错误消息,因为您的代码尚未执行。

For you API documentation, you could use the new WCF REST Starter Kit which provides a cool operation attribute WebHelpAttribute. This attribute produce some auto-generated operation description (request/response paypload format etc.)

对于API API文档,您可以使用新的WCF REST Starter Kit,它提供了一个很酷的操作属性WebHelpAttribute。该属性产生一些自动生成的操作描述(请求/响应paypload格式等)

Check the samples for examples.

检查样品的示例。

#1


You cant in W32 Service Host. You can in IIS Host.

你不能在W32服务主机。您可以在IIS主机中。

You cant change the default WCF endpoint error message because your code is not yet executed.

您无法更改默认的WCF端点错误消息,因为您的代码尚未执行。

For you API documentation, you could use the new WCF REST Starter Kit which provides a cool operation attribute WebHelpAttribute. This attribute produce some auto-generated operation description (request/response paypload format etc.)

对于API API文档,您可以使用新的WCF REST Starter Kit,它提供了一个很酷的操作属性WebHelpAttribute。该属性产生一些自动生成的操作描述(请求/响应paypload格式等)

Check the samples for examples.

检查样品的示例。