开发者

How to host Wcf service in IIS problem?

i have read more articles but i can nto host wcf service in IIS


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service name="WcfSrv.MyProject.GetTables.ServiceCrm">
        <endpoint address="" binding="wsHttpBinding" contract="WcfSrv.MyTechnic.GetTables.IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfSrv.MyProject.GetTables/ServiceTest/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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>
    </behaviors>
  </system.serviceModel>

</configuration>

MyCodes:These code wcf service codes


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data.Objects;

namespace WcfSrv.MyProject.GetTables
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
    public class ServiceTest : IService
    {
        public List GetAllData(string CustomerName)
        {
            using (CrmEntitie开发者_如何学编程s crmCtx = new CrmEntities())
            {
                return crmCtx.GetAllDataCustomer(CustomerName).ToList();
            }

        }


    }
}

i try to host my Wcf service 192.168.0.218 i added Srv file and dll new virtual directory but i can not use wcf service.How to make it? i changed config file Best Regards...


Have you (re)installed basic asp integration on IIS using aspnet_regiis -i (C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i)

Since you don't specify the exact error it is hard to help, but the svc files need to be bound in IIS which rerunning the above statement usually resolves that problem.


WCF services hosted in IIS are represented as special content files (.svc files) inside the IIS application. See Hosting WCF Services in IIS section here how to use it and how to host you WCF service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜