WCF web.config文件 [英] wcf web.config file

查看:211
本文介绍了WCF web.config文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,我的档案有这个结构。

ok, my file have this structure.

<system.serviceModel>
    <services>
        <service name="ManyaWCF.ServiceManya" behaviorConfiguration="ServiceBehaviour">
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address="" binding="webHttpBinding" contract="ManyaWCF.IServiceManya" behaviorConfiguration="web">
                <!-- 
             Upon deployment, the following identity element should be removed or replaced to reflect the 
             identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
             automatically.
         -->
            </endpoint>
        </service>

    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceBehaviour">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true" />
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="web">
                <webHttp />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

我得到了同样的web.config其他WCF和工作就像一个冠军,OFC具有不同的文件夹和文件。 我的文件夹结构是以下

i got the same web.config in other wcf and worked like a champ, ofc with different folders and files. my folder structure is the following.

当我尝试播放它,我得到这个,

When i try to play it i get this,

 Service

 This is a Windows © Communication Foundation.

 The metadata publishing for this service is currently disabled.

 If you access the service, you can enable metadata publishing by completing the following steps to modify the configuration file or web application:

 1. Create the following service behavior configuration, or add the item to a configuration <serviceMetadata> existing service behavior:

<behaviors>
<serviceBehaviors>
    <behavior name="MyServiceTypeBehaviors">
        httpGetEnabled="true" <serviceMetadata />
    </ Behavior>
</ ServiceBehaviors>
</ Behaviors>
 2. Add the behavior configuration to the service:

  name="MyNamespace.MyServiceType" <service behaviorConfiguration="MyServiceTypeBehaviors">
  Note: The service name must match the name of the configuration for the service implementation.

 3. Add the following to end service configuration:

 binding="mexHttpBinding" contract="IMetadataExchange" <endpoint address="mex" />
 Note: the service must have an http base address to add this.

 Here is an example of a service configuration file with metadata publishing enabled:

 <configuration>
 <system.serviceModel>

    <services>
        <! - Note: the service name must match the name of the configuration for the service implementation. ->
        name="MyNamespace.MyServiceType" <service behaviorConfiguration="MyServiceTypeBehaviors">
            <! - Add the following end. ->
            <! - Note: the service must have an http base address to add this. ->
            binding="mexHttpBinding" contract="IMetadataExchange" <endpoint address="mex" />
        </ Service>
    </ Services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="MyServiceTypeBehaviors">
                <! - Add the following item to the service behavior configuration. ->
                httpGetEnabled="true" <serviceMetadata />
            </ Behavior>
        </ ServiceBehaviors>
    </ Behaviors>

 </ System.serviceModel>
 </ Configuration>

  For more information about publishing metadata, see the following documentation: http://go.microsoft.com/fwlink/?LinkId=65455 (may be in English).

所以,我只是做了1 WCF并与同web.conif工作的罚款。我的EXP和了解这个运气是我的命。 任何线索?

so, i only did 1 wcf and worked fine with same web.conif. My luck of exp and knowledge about this is killing me. Any clue?

THX提前。

推荐答案

据我所知,你只需要与端点的 mexHttpBinding 如果你想揭露WSDL给客户。 Visual Studio中(或wcfutil.exe)需要WSDL描述来创建Web服务客户端类。

As far as I know, you only need the endpoint with the mexHttpBinding if you want to expose the WSDL to clients. Visual Studio (or wcfutil.exe) needs the WSDL description to create the webservice client classes.

在创建这些Web服务客户端类,你应该不必再暴露的WSDL。

After these webservice client classes are created, you shouldn't need to expose the WSDL anymore.

更新:&LT;服务&GT; 在配置文件中的元素应该是这样的:

UPDATE: The <service> element in your configuration file should look like this:

<service name="ManyaWCF.ServiceManya" behaviorConfiguration="ServiceBehaviour">
    <endpoint address="" binding="webHttpBinding" 
        contract="ManyaWCF.IServiceManya" behaviorConfiguration="web" />

    <endpoint address="mex" binding="mexHttpBinding" 
        contract="IMetadataExchange" />
</service>

这篇关于WCF web.config文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆