Wcf in Medium / Partial Trust(Mosso) - 奇怪的问题/配置错误

时间:2009-08-30 07:48:33

标签: wcf wcf-binding

呼!好的...我解决了我的Wcf / Linq错误(并且学到了很多东西 - 一系列的博客帖子将跟随下一个弱点)。现在我需要部署。我们在Mosso / Rackspace云上运行,目前该环境在部分信任环境中运行。

为了简单起见,我在我的Wcf服务中添加了一个方法,该方法几乎没有。

public string Echo(string what)
{
    return what;
}

我构建了所有内容,并使用以下Web.Config(仅限相关部分)将其发送到测试服务器...是的,我需要在暴露危险方法之前明显添加安全性,但是现在我想要匿名运行的东西:)

<system.serviceModel>
 <bindings>
   <basicHttpBinding>
       <binding name="BasicAnonymous">
           <security mode="None"/>                
       </binding>
   </basicHttpBinding>
</bindings>
 <behaviors>
  <serviceBehaviors>
   <behavior name="FooBar.Backend.Web.Services.CoreDataWcfServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="true" />
   </behavior>
  </serviceBehaviors>
 </behaviors>
 <services>
  <service behaviorConfiguration="FooBar.Backend.Web.Services.CoreDataWcfServiceBehavior"
   name="FooBar.Backend.Web.Services.CoreDataWcfService">
   <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicAnonymous" contract="FooBar.Backend.Web.Services.ICoreDataWcfService" />
   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
 </services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
   <baseAddressPrefixFilters>
       <add prefix="http://backend.FooBar.com"/>
   </baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>

所以,关闭我用控制台应用程序以最简单的方式调用它。我添加服务参考,它添加罚款。然后我称之为(我为了简洁起见了非活动代码)...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; 

using CoreWcfHarness.CoreDataServiceReference; 

namespace CoreWcfHarness
{
    class Program
    {
        static void Main(string[] args)
        {
            var context = new CoreDataWcfServiceClient(); 

            var echoval = context.Echo("Hello World!");
            Console.WriteLine(String.Format("{0}\n", echoval));
            Console.ReadKey();
        }
    }
}

而blammo。我受到了例外的打击。

System.ServiceModel.FaultException`1 was unhandled
  Message="Request failed."
  Source="mscorlib"
  StackTrace:
    Server stack trace: 
       at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at CoreWcfHarness.CoreDataServiceReference.ICoreDataWcfService.Echo(String what)
       at CoreWcfHarness.CoreDataServiceReference.CoreDataWcfServiceClient.Echo(String what) in C:\PathToProject\corewcfharness\service references\coredataservicereference\reference.cs:line 1890
       at CoreWcfHarness.Program.Main(String[] args) in C:\PathToProject\CoreWcfHarness\Program.cs:line 42
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

这很简单。任何熟悉中等信任环境和/或堆栈跟踪好的人?

谢谢!

1 个答案:

答案 0 :(得分:1)

“请求失败”可能是一些事情。

看起来最可能的原因是请求未到达服务器。您应该检查服务器日志以确保将请求发送到正确的位置。