如何发布asp.net Web应用程序中引用的wcf服务库?

时间:2016-02-24 14:20:45

标签: asp.net wcf iis

  1. 我将Wcf服务库项目引用到我的ASP.NET Web应用程序的服务引用。
  2. 我在本地IIS服务器中单独发布了Web应用程序。但FinananceService.svc服务文件在发布后没有添加到publiashed文件夹中。所以我手动将FinananceService.svc文件粘贴到已发布的文件夹中。因此,我可以使用“http://localhost:8080/FinanceService.svc”浏览FinananceService.svc文件 3.但是当我运行应用程序时,不会从asp.net网页调用Wcf服务。
  3. Web.config文件:

    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
    
      <system.web>
         <sessionState mode="InProc" timeout="360"></sessionState>
        <compilation targetFramework="4.0">
          <assemblies>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
        </compilation>
        <pages controlRenderingCompatibilityVersion="4.0"/>
      </system.web>
      <connectionStrings>
        <add name="SqlConn" connectionString="Data Source=HASHBYTESSERVER;Initial Catalog=Swasthik;Persist Security Info=True;User ID=sa;Password=hasH35" providerName="System.Data.SqlClient"/>
      </connectionStrings>
      <system.serviceModel>
        <client>
          <endpoint address="http://localhost:8080/Swas/FinanceService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFinanceService1" contract="HashFinanceService.IFinanceService" name="BasicHttpBinding_IFinanceService"/>
        </client>
    <services>
    <service name="HashFinanceService.FinanceService" behaviorConfiguration="ServiceBehaviour" >
    <endpoint address="http://localhost:8080/FinanceService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFinanceService"
    contract="HashFinanceService.IFinanceService" name="BasicHttpBinding_IFinanceService" listenUri="/">                
    </endpoint>
    <host>
    <baseAddresses >
    <add  baseAddress="http://localhost:8080/"/>
    </baseAddresses>
    </host>
    </service>
    </services>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IFinanceService" closeTimeout="00:20:00" openTimeout="00:20:00" sendTimeout="00:20:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
    readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    </binding>
            <binding name="BasicHttpBinding_IFinanceService1" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
            </binding>
          </basicHttpBinding>
          <netTcpBinding>
            <binding name="CustomWSBindingTcp">
              <reliableSession enabled="true"/>
            </binding>
          </netTcpBinding>
        </bindings>
    <behaviors>
                <serviceBehaviors>
                  <behavior name="ServiceBehaviour">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true "/>
                  </behavior>
                </serviceBehaviors>
              </behaviors>
         <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
        <defaultDocument>
          <files>
            <clear/>
            <add value="Login.aspx"/>
          </files>
        </defaultDocument>
      </system.webServer>
    </configuration>
    

    发布的文件夹结构:

    Published folder structure

    请指导我如何处理。

0 个答案:

没有答案