English 中文(简体)
WCF RESTFul Service - 404, 终点:2个服务
原标题:WCF RESTFul Service - 404 with endpoint not found with 2 services

我有两个WCF服务交换所,一个是RESTful JSON公司。 交换1.svc公司进行罚款,但当我试图进行2.svc的换文时,我拿到一个终点站没有找到信息。

我做了什么错误?

我的IExchange2接口是:

[ServiceContract]
public interface IExchange2
{
    [System.ServiceModel.OperationContract(Name = "InsertReading")]
    [WebInvoke(UriTemplate = "/InsertReading?memberID={memberID}", Method = "POST", ResponseFormat = WebMessageFormat.Json)]
    void InsertReading(string memberID);
}

http:// localhost:49701/Exchange2.svc/DiaInsertReading?memberID=6519548"rel=“nofollow” http:// localhost:49701/Exchange2.svc/DiaInsertReading?memberID=65848

My config is:

<system.serviceModel>
<behaviors>
    <endpointBehaviors>
        <behavior name="MyNamespace.Exchange1Behavior">
            <webHttp/>
        </behavior>
        <behavior name="MyNamespace.Exchange2Behavior">
            <webHttp/>
        </behavior>             
    </endpointBehaviors>
</behaviors>
<services>
    <service name="MyNamespace.Exchange1">
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="MyNamespace.Exchange1Behavior" contract="MyNamespace.IExchange1" />
    </service>
    <service name="MyNamespace.Exchange2">
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="MyNamespace.Exchange2Behavior" contract="MyNamespace.IExchange2" />
    </service></services></system.serviceModel>
最佳回答

我编辑了我的职位,因为回答没有帮助。 既然你是在国际空间法学会的东道国,你就不必像我在先前的回答中所说的那样,在你具有约束力的发言中找到一个地址。 基础是服务器的位置。 参看:http:// localhost:49701/Exchange2.svc。 如果你打上了这一地址,你就应当上世界家庭论坛服务网页。

Since you are using POST method you can send the data in the request body. If you have fiddler installed, in the composer you can set the method to post and address to http://localhost:49701/Exchange2.svc/InsertReading if this is your address to your service. In the body of the request body you set { memberID:"123" } change 123 to whatever value you want to send to your service.

或您可以发送地址中的数据,如:http:// localhost:49701/Exchange2.svc/InsertReading?memberID=123

如果你现在执行你的请求,它就应回复200个科索沃。

问题回答

web.config文档中注明了您的终点。

<service name="MyNamespace.Exchange2">
<endpoint address="Exchange2" binding="webHttpBinding" behaviorConfiguration="MyNamespace.Exchange2Behavior" contract="MyNamespace.IExchange2" />

之后,在《欧洲刑法》中添加以下两点:

http://localhost:49071/Exchange2/DiaInsertReading?memberID=6519548




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签