私はWCFで問題を解決しようとしていました。私はWCFにはとても新しいので、何が起こっているのか正確にはわからなかった。AspNetCompatibilityRequirementsMode.Allowedがこのエラーを修正するのはなぜですか?
私はVisual Studio 2010を使用しており、新しいWebサイト - > WCFサービスを行っています。サービスを作成し、設定ファイルにaspNetCompatibilityEnabled="true"
を設定すると、私のWebブラウザからサービスに行くときにこのエラーが発生します。
The service cannot be activated because it does not support ASP.NET compatibility.
ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config
or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode
setting as 'Allowed' or 'Required'.
この意味はわかりません。 [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
を修正すると、なぜaspNetCompatibilityEnabled="true"
がこのエラーを引き起こすのですか?
私にとって、彼らは同じことをするように聞こえる。また、その属性がなければ、Silverlightは私のWCFメソッドを呼び出すことができませんでした。何故ですか?必要であれば、ここで
は私の設定ファイルである:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<services>
<service name="Services.Exporter">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer"
contract="Services.IExporter" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment
multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
だから私の質問は、なぜ互換性を追加しないと、その属性を修正するのですか?また、なぜ銀色のためにそれが必要でしたか?
質問、私はそれをtrueに設定すると、この適切な装飾は何ですか? – Justin
サービスがASP.NETパイプラインで利用可能なアイテムを必要とするかどうかによって異なります。本当に気にしなければ、それを 'RequirementsMode.Allowed'に設定します。これらのコンポーネント(Sessionなど)に依存している場合は、それを 'RequirementsMode.Required'に設定する必要があります。 –