How does a service host in WCF interact with the configuration from the web.config or app.config. When I create a service host I only specify an url in the service host constructor and the class of the service.
But in the app.config or web.config I have another list of endpoints, each with it's own specific url. So how does wcf handle this situation? Which endpoint does it take from the app.config or web.config?
You can have a web. config for each folder under your web application. app. config is used for windows applications.
config ? The web. config files specify configuration settings for a particular web application, and are located in the application's root directory; the machine. config file specifies configuration settings for all of the websites on the web server, and is located in $WINDOWSDIR$\Microsoft.Net\Framework\Version\Config.
A configuration file (web. config) is used to manage various settings that define a website. The settings are stored in XML files that are separate from your application code. In this way you can configure settings independently from your code.
The web. config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS.
The address of the endpoint is relative to the base address of the service host. For example, if you had these endpoints:
<service name="MyService">
<endpoint address="" binding="ws2007HttpBinding" contract="IMyService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
and a service host url of http://localhost:7777
, then you would be exposing your service on http://localhost:7777
, and the metadata on http://localhost:7777/mex
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With