我有一个Wcf Service Application
项目被不同的项目引用和使用。启动 Visual Studio 2012 时一切正常 - IIS Express 已启动,托管在 localhost 上。
我试图Publish
在我的Wcf Service Application
. 我创建了一个新的发布配置文件:
击球Publish
有效。我可以通过互联网浏览器访问它http://localhost
。但是,当我通过 bin/Debug 中的可执行文件正常启动我的应用程序时 - 它不起作用(应用程序崩溃)。我应该怎么办?我可以上传它并使用 IIS 管理器轻松配置它(尝试过,但出现一些访问错误)?我需要在我没有安装任何 VS 的虚拟机中使用它。
令我困扰的是,在我Wcf Service Application
的项目Web.config
文件中,我指定了这样的基地址:http://localhost:8733/WcfServiceLibrary/MailingListService/
而在客户端中,App.config
我的端点的地址如下:http://localhost/MailingListService.svc
. 是否可以有不同的端口和地址(一个在 root,另一个在WcfServiceLibrary
)?在 Visual Studio 中运行时效果很好。
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="Data Source=(local)\SQLEXPRESS;Initial Catalog=Newsletter;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True"" 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>
App.config
:
<?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>