0

mono 2.10.8 を使用して CentOS で WCF サービスをホストし、REST または SOAP サーバーとしてアクセスしようとしています。

web.config を含むフォルダーで mod-mono-server-4 を使用してアプリケーションを開始しました。

<configuration>
    <system.serviceModel>
        <services>
            <service behaviorConfiguration="WebBehavior" name="Services.Hello">
                <clear/>
                <endpoint address="http://DOMAIN/service" behaviorConfiguration="HelloBehavior" binding="webHttpBinding" contract="Services.IHello" />
                <endpoint address="http://DOMAIN/web" binding="basicHttpBinding" bindingConfiguration="" contract="Services.IHello" />
            </service>
        </services>
        <behaviors>
            <endpointBehaviors>
                <behavior name="HelloBehavior">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>
                <behavior name="WebBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>

ここでDOMAIN/web?wsdlor DOMAIN/service/hello(/helloは IHello のメソッドの WebGetAttribute の UriTemplate ) を呼び出すと、404 しか返されません。

'/' アプリケーション
のサーバー エラー リソースが見つかりません。

Service.svc以下を含むファイルもあります。

呼び出すDOMAIN/Service.svc/helloと、SOAP エラーが発生します。

要求メッセージには、このサービス コントラクトでは到達できないアクション '' を持つターゲット 'http://DOMAIN/Service.svc/hello' があります

サーバー上でコンソール アプリケーションを起動すると、次のように実行されます。

WebServiceHost sh = new WebServiceHost(typeof(Hello), new Uri("http://localhost:681/service"));
sh.Open();

ポート 680 でサービスにアクセスできるので、モノはサービスを実行できるはずですが、mod_mono (ポート 80) で実行する必要があります。

別の設定を行うには何が必要ですか?

最後に、SyndicationFeed をホストして RSS/Atom-Feed を配信しようとしています。

4

1 に答える 1

0

ATM を実行するための回避策を見つけました:
通常の *.asmx-WebService を作成し、次のようなメソッドを作成します。

[WebMethod]
[SoapDocumentMethod(ParameterStyle=SoapParameterStyle.Bare)]
public XmlDocument Feed()
{
    SyndicationFeed feed = new SyndicationFeed();
    //Fill the feed...
    Atom10FeedFormatter atom = new Atom10FeedFormatter(feed);

    StringBuilder result = new StringBuilder();
    XmlWriter writer = XmlWriter.Create(result);
    atom.WriteTo(writer);
    writer.Flush();

    XmlDocument doc = new XmlDocument();
    doc.LoadXml(result.ToString());

    return doc;
}

その後、 でフィードにアクセスできますDOMAIN/Service.asmx/Feed

于 2012-01-26T16:30:06.230 に答える