私はLinuxとOS Xの両方でこれを試しましたが、同じ問題があります。これはMonoDevelop 2.6で、最新の安定版Monoを使用しています。私のMacではvs 2.10.2です。モノでのWCFサービスにアクセスできませんか?
これは数日前に私のために働いていました。私はブラウザに "http:// localhost:8000/number/test"と指摘し、 "コマンドラインでsvcutil http:// localhost:8000/number/test [somethingmore] 「
は今、私は、ブラウザでLinuxとMacの両方に乗るメッセージは次のとおりです。
<Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none">
a:InternalServiceFault
サーバが内部エラーのため要求を処理できませんでした。サーバーは例外の詳細を返すことができます(サーバーの設定によって異なります)。
これは動作するために使用、私は重要な何かが足りないか、何かがモノラルまたは何が間違っている場合だ場合、私はわかりません。あなたにアイデアがあることを願っています。これは、MSDNのチュートリアル(いくつかの変更が加えられています)からまっすぐです。
(知っている人のために、私はこれまでにセッション用に設定されていないため、状態を保存できないことを認識しています。
ここに私のクラスは次のとおりです。
using System;
using System.ServiceModel;
namespace NumberService
{
[ServiceContract]
public interface INumberService
{
[OperationContract]
void Add(int val);
[OperationContract]
void Subtract(int val);
[OperationContract]
int Result();
}
}
using System;
namespace NumberService
{
public class NumberService : INumberService
{
private int val = 1;
public NumberService()
{
Console.WriteLine("NumberService created.");
}
public void Add(int val)
{
this.val += val;
}
public void Subtract(int val)
{
this.val -= val;
}
public int Result()
{
return val;
}
}
}
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
namespace NumberService
{
class MainClass
{
public static void Main (string[] args)
{
Uri uri = new Uri("http://localhost:8000/number/test");
ServiceHost selfHost = new ServiceHost(typeof(NumberService), uri);
try
{
// Step 3 of the hosting procedure: Add a service endpoint.
selfHost.AddServiceEndpoint(
typeof(INumberService),
new WSHttpBinding(SecurityMode.None),
"NumberService");
// Step 4 of the hosting procedure: Enable metadata exchange.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
selfHost.Description.Behaviors.Add(smb);
// Step 5 of the hosting procedure: Start (and then stop) the service.
selfHost.Open();
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.WriteLine();
Console.ReadLine();
// Close the ServiceHostBase to shutdown the service.
selfHost.Close();
}
catch (CommunicationException ce)
{
Console.WriteLine("An exception occurred: {0}", ce.Message);
selfHost.Abort();
}
}
}
}
私はWindows 7で動作します - Visual Studio AND Mono –