我正在尝试在appharbor.com上托管WCF网络服务 该服务在本地托管时按预期响应,但在appharbor构建和托管时,它只返回404。
该服务正在控制台应用程序中运行:
namespace Service.Host
{
class Program
{
static void Main(string[] args)
{
var host = new ServiceHost<AchievementService>();
host.Open();
Console.WriteLine("AchievementService is running...\nPush any key to terminate.");
Console.ReadLine();
host.Close();
}
}
}
app.config看起来像这样:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="Service.Main.AchievementService">
<host>
<baseAddresses>
<add baseAddress="http://achiever.apphb.com"/>
<!--<add baseAddress="http://localhost"/>-->
</baseAddresses>
</host>
<endpoint address="AchievementService/"
behaviorConfiguration="RestBehavior"
binding="webHttpBinding"
contract="Service.Main.Contracts.IAchievementService"/>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="RestBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
如果我使用包含值“http:// localhost”的baseaddress,我可以在我的webservice中访问get方法,元数据,帮助等。但是当我将其更改为achiever.apphb.com并构建它时,我只会在http://achiever.apphb.com/AchievementService/或http://achiever.apphb.com/
收到404我所尝试的是各种地址配置,我尝试在appharbor上构建localhost,结果相同。我也搜索了一些例子,但我找不到任何可以帮助我解决这个问题的东西。
该服务已部署且未包含任何测试,其中包含来自appharbor的注释:
5/5/12 6:02 PM: Received notification, queuing build
5/5/12 6:02 PM: Downloading source
5/5/12 6:02 PM: Downloaded source in 0.27 seconds
5/5/12 6:02 PM: Starting build
5/5/12 6:02 PM: 0 warnings
5/5/12 6:02 PM: Build completed in 1.57 seconds Details
5/5/12 6:02 PM: Starting website precompilation
5/5/12 6:02 PM: Precompilation completed
5/5/12 6:02 PM: Starting tests
5/5/12 6:02 PM: Tests completed in 2.39 seconds
5/5/12 6:02 PM: Build successfully deployed
Tests
Build contains no tests
答案 0 :(得分:0)
请检查您的构建状态和测试。如果您的某个测试失败,则无法部署项目。
答案 1 :(得分:0)
我遇到了WCF服务的元数据问题。但是能够看到使用* .svc位置的WCF服务。你服务的http://achiever.apphb.com/AchievementService/[Name是.svc适合你吗?