C# Visual Studio 2012+;IIS 8.0=如何在本地主机上部署WCF服务?

C# Visual Studio 2012+;IIS 8.0=如何在本地主机上部署WCF服务?,c#,.net,wcf,iis,C#,.net,Wcf,Iis,我有一个Wcf服务应用程序项目,它被不同的项目引用并用于不同的项目。当Visual Studio 2012启动时,一切正常-IIS Express在本地主机上启动 我试图使用我的Wcf服务应用程序的右键单击菜单中的Publish选项。我创建了用于发布的新配置文件: 点击Publish有效。我可以通过http://localhost。但是,当我通过bin/Debug中的可执行文件正常启动应用程序时,它不工作(应用程序崩溃)。我该怎么办?我可以上传它并使用IIS管理器轻松配置它吗(尝试过,但遇到

我有一个
Wcf服务应用程序
项目,它被不同的项目引用并用于不同的项目。当Visual Studio 2012启动时,一切正常-IIS Express在本地主机上启动

我试图使用我的
Wcf服务应用程序的右键单击菜单中的
Publish
选项。我创建了用于发布的新配置文件:

点击
Publish
有效。我可以通过
http://localhost
。但是,当我通过bin/Debug中的可执行文件正常启动应用程序时,它不工作(应用程序崩溃)。我该怎么办?我可以上传它并使用IIS管理器轻松配置它吗(尝试过,但遇到一些访问错误)?我将需要在我的虚拟机没有任何VS安装

让我烦恼的是,在我的
Wcf服务应用程序
project的
Web.config
文件中,我有如下指定的基址:
http://localhost:8733/WcfServiceLibrary/MailingListService/
在clients
App.config
中,我的端点地址如下:
http://localhost/MailingListService.svc
。可以使用不同的端口和地址(一个在根目录下,另一个在
WcfServiceLibrary
)吗?在VisualStudio中运行时,它可以正常工作

Web.config

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="NewsletterEntities" connectionString="metadata=res://*/NewsletterDAL_EF.csdl|res://*/NewsletterDAL_EF.ssdl|res://*/NewsletterDAL_EF.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(local)\SQLEXPRESS;Initial Catalog=Newsletter;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WCFHost.MessageService">
        <endpoint address="" binding="basicHttpBinding" contract="WCFHost.IMessageService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/WcfServiceLibrary/MessageService/" />
          </baseAddresses>
        </host>
      </service>
      <service name="WCFHost.MailingListService">
        <endpoint address="" binding="basicHttpBinding" contract="WCFHost.IMailingListService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/WcfServiceLibrary/MailingListService/" />
          </baseAddresses>
        </host>
      </service>
      <service name="WCFHost.RecipientService">
        <endpoint address="" binding="basicHttpBinding" contract="WCFHost.IRecipientService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/WcfServiceLibrary/RecipientService/" />
          </baseAddresses>
        </host>
      </service>
      <service name="WCFHost.SenderService">
        <endpoint address="" binding="basicHttpBinding" contract="WCFHost.ISenderService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/WcfServiceLibrary/SenderService/" />
          </baseAddresses>
        </host>
      </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>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IMessageService" />
                <binding name="BasicHttpBinding_IRecipientService" />
                <binding name="BasicHttpBinding_IMailingListService" />
                <binding name="BasicHttpBinding_ISenderService" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:2433/MessageService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMessageService"
                contract="MessageServiceReference.IMessageService" name="BasicHttpBinding_IMessageService" />
            <endpoint address="http://localhost/RecipientService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRecipientService"
                contract="RecipientServiceReference.IRecipientService" name="BasicHttpBinding_IRecipientService" />
            <endpoint address="http://localhost/MailingListService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailingListService"
                contract="MailingListServiceReference.IMailingListService"
                name="BasicHttpBinding_IMailingListService" />
            <endpoint address="http://localhost/SenderService.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_ISenderService" contract="SenderServiceReference.ISenderService"
                name="BasicHttpBinding_ISenderService" />
        </client>
    </system.serviceModel>
</configuration>

什么都不要麻烦。只需执行以下操作: 1) 在服务url字段中输入localhost。
2) 在站点字段的inetmgr中添加的网站的名称。

不要麻烦任何事情。只需执行以下操作: 1) 在服务url字段中输入localhost。
2) 您在站点字段的inetmgr中添加的网站的名称。

我忘记了详细信息,所以只需发表评论。您需要让客户端指向IIS并更新端点。我这样做了,但现在我在尝试调用WCF服务调用时遇到了
FaultException
。当前
App.config
的端点示例:
我认为您需要在我的
Web.config
中为mexLook添加一个行为。已经有了
。这就是你的意思吗?我忘了细节,所以只留下评论。您需要让客户端指向IIS并更新端点。我这样做了,但现在我在尝试调用WCF服务调用时遇到了
FaultException
。当前
App.config
的端点示例:
我认为您需要在我的
Web.config
中为mexLook添加一个行为。已经有了
。这就是你的意思吗?