. Net service bus debugging

Source: Internet
Author: User
If you disable the service first and then disable the client

The client's Channel. Close () will report an exception:

"The communication object, system. servicemodel. channels. servicechannel, cannot be used for communication because it is in the faulted State ."

 

Open the client if the service is not started.

The client's Channel. open () will report an exception:

"The endpoint was not found. Please ensure that you can connect to the Internet using http port 80 and TCP port 808 ."

 

The namespace of the client and service properties is inconsistent.

For example:

Client:

[Servicecontract (name =   " Iechocontract " , Namespace =   " Http://samples.microsoft.com/ServiceModel/Relay/ " )]
Public   Interface Iechocontract
{
[Operationcontract]
String echo ( String Text );
}

Server:

// Note that an echo is added.
[Servicecontract (name =   " Iechocontract " , Namespace =   " Http://samples.microsoft.com/ServiceModel/Relay/Echo " )]
Public   Interface Iechocontract
{
[Operationcontract]
String echo ( String Text );
}

An exception is reported when the client executes channel. Echo (input:

"The message with Action 'HTTP: // samples.microsoft.com/servicemodel/relay/iechocontract/echo' cannot be processed at the specified er, due to a contractfilter mismatch at the endpointdispatcher. this may be because of either a contract mismatch (mismatched actions between sender and caller) or a binding/security mismatch between the sender and the caller. check that sender and receiver er have the same contract and the same binding (including security requirements, e.g. message, transport, none )."

 

Avoid contract and behavior paste & copy Error

If servicecontract is used for a place that should use servicebehavior, for example:

 

// Shocould be [servicebehavior (name = "echoservice", namespace = Http://samples.microsoft.com/ServiceModel/Relay/ )]
[Servicecontract (name =   " Iechocontract " , Namespace = HTTP: // Samples.microsoft.com/servicemodel/relay/)]
Public   Class Echoservice: iechocontract
{
Public   String Echo ( String Text)
{
Console. writeline ( " Echoing: {0} " , Text );
Return Text;
}
}

When a new host is created, servicehost host = new servicehost (typeof (echoservice), address); // an exception is thrown.
Exception information:

"the service class of Type Microsoft. servicebus. samples. echoservice both defines a servicecontract and inherits a servicecontract from type Microsoft. servicebus. samples. iechocontract. contract inheritance can only be used among interface types. if a class is marked with servicecontractattribute, it must be the only type in the hierarchy with servicecontractattribute. consider moving the servicecontractattribute on type Microsoft. servicebus. samples. iechocontract to a separate interface that type Microsoft. servicebus. samples. iechocontract implements. "

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.