繁体   English   中英

在Windows Server 2012上配置和安装WCF应用程序

[英]Configuring and installing a WCF app on Windows Server 2012

我正在使用Web服务应用程序。 该项目使用的工具是Windows Server 2012 Standard和Visual Studio Pro2013。应用程序位于C#、. NET 4.5中

在此应用程序开发的初期,它处于概念验证阶段。 没有数据库,一点都不花哨。 试图使基本架构起作用。 在开发环境中运行,一切正常。 发布到服务器不起作用。 我收到404-尝试在浏览器中打开此页面时找不到文件或目录。 在我的开发系统/个人Web服务器上,我可以在显示的页面上看到运行该应用程序的结果。

我已经看过许多教程和逐步说明。 一点非常有帮助。

在服务器端进行一些工作之后,我得到了Web部署功能,可以从开发系统到服务器工作。 我还尝试了其他安装技术。

因为我不太了解IIS体系结构,所以我一直在缩小问题的范围,这似乎是问题所在,除非我误解了运行测试/概念验证的某些方面。 运行服务器进行调试的服务提供商没有得到太多帮助。

关于如何缩小这个问题的任何想法; 在哪里看,尝试其他测试,非常感谢。

web.config(这是由

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="false" />
  </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="Test.Service1">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8371/Design_Time_Addresses/Test/Service1/" />
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="" binding="basicHttpBinding" contract="Test.IService1">
          <!-- 
              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.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>

将其添加到配置中可以解决该问题。

<system.webServer>
    <handlers>
        <add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="File" requireAccess="Script" preCondition="integratedMode" />
    </handlers>
</system.webServer>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM