Mostrando postagens com marcador AppFabric. Mostrar todas as postagens
Mostrando postagens com marcador AppFabric. Mostrar todas as postagens

sexta-feira, 4 de outubro de 2013

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding . The base address schemes are [ http , https ] .

Hi!

If you are receiving this error when you try to access your webservice, something like http://www.you.com/yourservice.svc?wsdl. The solution might be simple.
 

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding . The base address schemes are [ http , https ] .Description : An unhandled exception occurred during the execution of the current web request Please review the stack trace for more information about the error and where it originated in the code .
Exception Details : System.InvalidOperationException : Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding . The base address schemes are [ http , https ] .
Source Error :Unhandled exception was generated during the execution of the current web request Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace :
[ InvalidOperationException : Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding . The base address schemes are [ http , https ] . ]
   
System.ServiceModel.ServiceHostBase.MakeAbsoluteUri ( Uri relativeOrAbsoluteUri , Binding binding , UriSchemeKeyedCollection baseAddresses ) +12349612
   
System.ServiceModel.Description.ConfigLoader.LoadServiceDescription ( ServiceHostBase host ServiceDescription description , ServiceElement serviceElement , Action ` 1 AddBaseAddress ) +12346965
   
System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal ( ConfigLoader configLoader , ServiceDescription description , ServiceElement serviceSection ) +67
   
System.ServiceModel.ServiceHostBase.ApplyConfiguration ( ) +108
   
System.ServiceModel.ServiceHostBase.InitializeDescription ( UriSchemeKeyedCollection baseAddresses ) +192
   
System.ServiceModel.ServiceHost.InitializeDescription (Type serviceType , UriSchemeKeyedCollection baseAddresses ) +49
   
System.ServiceModel.ServiceHost .. ctor (Type serviceType , Uri [ ] baseAddresses ) +151
   
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost (Type serviceType , Uri [ ] baseAddresses ) +30
   
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost ( constructorString String , Uri [ ] baseAddresses ) +422
   
System.ServiceModel.HostingManager.CreateService ( String normalizedVirtualPath ) +1461
   
System.ServiceModel.HostingManager.ActivateService ( String normalizedVirtualPath ) +44
   
System.ServiceModel.HostingManager.EnsureServiceAvailable ( String normalizedVirtualPath ) +651
[ ServiceActivationException : Can not activate service ' / Fibra.Barramento.Calculo / Motor.svc ' due to an exception during compilation . The exception message is : Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding . The base address schemes are [ http , https ] ..]
   
System.Runtime.AsyncResult.End ( IAsyncResult result ) +688590
   
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End ( IAsyncResult result ) +190
   
System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest ( IAsyncResult ar) +310694
   
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion ( IAsyncResult ar) +94



Maybe, all you have to do is enable the protocol. The default protocol is http. Net.tcp must be enabled manually. So, add net.tcp, clicking on advanced settings and that's it.
 



Could not load type System.ServiceModel.Activation.HttpModule assembly System.ServiceModel, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089.

Well, this error took me a lot of time to understand. The message is completely misleading.
In my case the problem was that IIS had two versions of ServiceModel. For some reason the application was trying to load System.ServiceModel.dll version 3.0.0.0 , but was "suprised" by the version 4.0.0.0.
So, what was my solution? I removed the version 3. Did something crash? Not at all. Everything is working fine.
Never had the error again.
Há!


quinta-feira, 29 de agosto de 2013

Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota.


OK, that's the problem.

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ObterSituacaoClienteGrupoResult. The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. '.  Please see InnerException for more details.

First of all, this message was received by the client of the service. So, the issue has two sides: client and server.

The server side

On the server side you're gonna have to add a new property to your behaviour.

Example



  <system.serviceModel>

    <behaviors>

      <serviceBehaviors>
        <behavior name="MyBehaviour">
          <serviceMetadata httpGetEnabled="False" httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
    <services>


      <service behaviorConfiguration="MyBehaviour" name="Netdaniels.Services.Rating">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="MyBehaviour" bindingNamespace="http://www.netdaniels.com.br/product/risk/v1" contract="Netdaniels.Contract.IRisk" />



        <host>
          <baseAddresses>
            <add baseAddress="/Risk.svc" />
          </baseAddresses>
        </host>
      </service>

Unfortunately you have to change the client site too.

The client side

Example

<system.serviceModel>
<behaviors>
      <endpointBehaviors>
        <behavior name="MyBehaviour">
          <dataContractSerializer maxItemsInObjectGraph="2147483646" />
        </behavior>
      </endpointBehaviors>
</behaviors>

      <endpoint address="net.tcp://serverofclient:10261/Netdaniels.MyClient/shaba/"
                binding="netTcpBinding" behaviorConfiguration="MyBehaviour" bindingConfiguration="NetTcpBinding_IShaba"
                contract="ServicesNetdaniels.IShaba" name="NetTcpBinding_IShaba">
        <identity>
          <servicePrincipalName value="host/serverofclient" />
        </identity>
      </endpoint>

This is one of the most annoying problems I ever had.

I don't know if you noticed but there's a ripple effect related to this problem.

SERVER1 <- CLIENT 1 <- CLIENT 2 <- CLIENT 3

The scheme above means that, if you change configuration of server 1 you'll have to change configuration of client 1. If client 1 has a client, the configuration of this one must be changed too ans so on.

That's all folks!