ok, tệp của tôi có cấu trúc này.tệp wcf web.config
<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>
tôi có cùng web.config trong wcf khác và làm việc như một nhà vô địch, ofc với các thư mục và tệp khác nhau. cấu trúc thư mục của tôi là như sau.
Khi tôi cố gắng để chơi nó tôi có được điều này,
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).
như vậy, tôi chỉ làm 1 WCF và làm việc tốt với cùng web.conif. May mắn của tôi về exp và kiến thức về điều này là giết chết tôi. Bất kỳ đầu mối nào?
Thx trước.
hmm. tôi có thể thấy mexhttpbinding trên mã. Tôi không thể nhìn thấy nếu có điều gì đó sai hoặc cần phải cơ hội một cái gì đó –
@Guillermo - Tôi không thấy điểm cuối mex được kích hoạt trong tệp cấu hình của bạn. Có thể bài viết sau sẽ giúp: http://blogs.msdn.com/b/brajens/archive/2007/04/26/accessing-description-metadata-wsdl-of-wcf-web-service.aspx –
không phải là điều này, ?? –