Few things to take note:
1) The error messages will appear in Event Log when the WCF service is being invoked. It is located in Event Viewer > Windows Logs > Application.
2) The service and contract name defined here are just an example.
[Issue 1]
The type 'SA.Services.ComputerService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Note: "ComputerService" is your service / class name that are belongs to the namespace "SA.Services".
[How to solve]
What the error means is that it can't locate the WCF service that you have implemented. So do verify the following:
1) If your WCF service is implemented in another project, make sure that it is being referenced in your web application or self hosting WCF project, and
2) Double check and make sure the service name and namespace that you defined in configuration file are correct. The value should be define in the service attribute under system.serviceModel/serviceHostingEnvironment/serviceActivations/add element. Sample configuration is as follows.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="./ComputerService.svc"
service="SA.Services.ComputerService" />
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
[Issue 2]
The contract name 'SA.Services.Contracts.IComputerService' could not be found in the list of contracts implemented by the service 'ComputerService'.
Note: "IComputerService" is your interface / contract name that are belongs to the namespace "SA.Services.Contracts"
[How to solve]
This error message is stating that your WCF service does not implement the interface / contract named "IComputerService". Verify the following:
1) Make sure that the WCF service that you implemented is implementing the contract that you defined in your configuration file, and
2) Check the spelling of your contract name and namespace in configuration file. Contract is defined in the contract attribute under system.serviceModel/services/service/endpoint element. The following are the sample configuration.
<system.serviceModel>
<services>
<service name="SA.Services.ComputerService"
behaviorConfiguration="DefaultServiceBehavior">
<endpoint name="basicHttpComputerService"
address=""
binding="basicHttpBinding"
contract="SA.Services.Contracts.IComputerService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
[Issue 3]
Memory gates checking failed because the free memory (267431936 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
[How to solve]
This error message appear when the machine that hosted your application does not have sufficient memory. You have a few options to resolve this issue.
1) Increase your machine's memory by adding more RAM, or
2) If your machine is a virtual machine, assign more memory to your virtual machine, or
3) Close and uninstall any unused applications or any applications that runs in background, or
4) Check and make sure your application is not the cause of memory leak, or
5) Deploy your application to another machine that has sufficient memory to run your application, or
6) Reduce number of deployed / hosted application, or
7) Lower the attribute "minFreeMemoryPercentageToActivateService" value as the default value is 5. It is strongly discourage to use this option. Imagine that if your machine has less than 5% available memory but your application still continue to run, it will not only makes the machine freeze, hang or not responsive when interact with it, but also causes other applications to run slower. Refer to below for the sample configuration.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"
minFreeMemoryPercentageToActivateService="5">
</serviceHostingEnvironment>
</system.serviceModel>
No comments:
Post a Comment