WCF

Solving “The requested service, ‘http://MyService.svc’ could not be activated. See the server’s diagnostic trace logs for more information.” error

While working in WCF project I got this error while accessing wcf service.
“The requested service, ‘http://MyService.svc’ could not be activated. See the server’s diagnostic trace logs for more information.”

But when I was running service separately then It was running.

After searching for some time I got one solution which works for me.

Solution is as follows:

In of your web.config of your application just add

OperationContract attributes/properties of the WCF in .net framework 4.0

OperationContract attributes/properties

1. Action:

2. AsycnPattern:

3. IsInitiating:If we are using this attribute the SessionMode attribute of the ServiceContract should be defined.It has two modes

a. True:It is default mode .If IsInitiating property is true then that method can be called at the beginning.
b. False: If IsInitiating property is false then that method cannot be called at the beginning.

4. IsTerminating: If we are using this attribute the SessionMode attribute of the ServiceContract should be defined.It has two modes

a. True:If IsTerminating property is true then session will end after implementation of that method.
b. False: IsTerminating property is true then session will not end after implementation of that method.

5. Name: This is used to provide the name to the method by which client will call it.

6. ProtectionLevel:It is System.Net.Security.ProtectionLevel which defines the protection level of the service contract. It has three modes.

a. EncryptAndSign: It ensures that data will be encrypted & signed before it is transmitted.
b. None: Data will not be signed nor encrypted & it is transmitted as it is.
c. Sign: Data will only signed before it is transmitted.

7. ReplyAction:

8. IsOneWay:It has two modes

a. True: It specifies that the method will not return anything. Method’s return type should be “void” if IsOnwWay is true.
b. False: It is default value for the OperationContract. No need to specify this if method returns anything.

Service Contract (ServiceContract) Attributes/properties of WCF in framework 4.0

ServiceContract has about 6 properties/attributes.

Service Contract Attributes

1. CallbackContract:

2. ConfigurationName:

3. Name: This is used to provide the name to the service contract by which client will call it.

4. Namespace: The namespace property is really an XML term. It allows you to maintain uniqueness with elements. So you can have multiple elements of the same tag name but they are completely different as long as they have different namespaces.

5. ProtectionLevel: it is System.Net.Security.ProtectionLevel which defines the protection level of

the service contract. It has three modes.

a. EncryptAndSign: It ensures that data will be encrypted & signed before it is transmitted.

b. None: Data will not be signed nor encrypted & it is transmitted as it is.

c. Sign: Data will only signed before it is transmitted.

6. SessionMode: It Specifies that whether service contracts supports session or not.

It has three modes

a. Allowed: It specifies that if incoming binding supports session then it supports the session.

b. NotAllowed: It specifies that contract will never support session & the never support

the binding that initiates the session.

c. Required: It specifies that contract needs session & exception is thrown if binding do not support the session.

 Scroll to top