The remote server returned an unexpected response: (405) Method Not Allowed.

Sep 1, 2010 at 10:41 AM

Hi,

Both the ConsoleHost and WebHost run perfectly but when I run the website from the Presentation layer, I see an error message on the top of the Default.aspx page.

The remote server returned an unexpected response: (405) Method Not Allowed.

Any sort of help would be greatly appreciated.

Thanks

Coordinator
Sep 1, 2010 at 1:33 PM
Edited Sep 1, 2010 at 1:34 PM

That's a challenging error :)

Can you try/check the following:

  • Make sure that there is only 1 host running at any one time because all the hosts use the same port, so there will be conflicts.
  • Make sure your firewall did not block the ports.
  • Make sure you are running as an administrator.
  • If you are configuring the client to use the web host, you will need to point the service to the .svc file. i.e. http://localhost:8000/ExpenseWorkflowService.svc
  • If you are hosting the web hosts and web clients in IIS, make sure the site is configured to use .NET 4.0.

Hope this helps. :)

Best Regards,
Serena

Sep 7, 2010 at 7:05 AM
Edited Sep 7, 2010 at 7:11 AM
firedancer wrote:

That's a challenging error :)

Can you try/check the following:

  • Make sure that there is only 1 host running at any one time because all the hosts use the same port, so there will be conflicts.
  • Make sure your firewall did not block the ports.
  • Make sure you are running as an administrator.
  • If you are configuring the client to use the web host, you will need to point the service to the .svc file. i.e. http://localhost:8000/ExpenseWorkflowService.svc
  • If you are hosting the web hosts and web clients in IIS, make sure the site is configured to use .NET 4.0.

Hope this helps. :)

Best Regards,
Serena

Hi Serena. Thanks for the prompt response. I've gone through your checklist and I've attached screen shots for reference.

http://i51.tinypic.com/jz7i15.jpg

1. Under IIS Management Console > Sites only one is host running under port 8000.

http://i51.tinypic.com/2q2my3t.jpg

2. I tried disabling my firewall

3. I ALWAYS run EVERYTHING as Administrator :)

4. This is what the web clients web.config and the web hosts web.config respectively look like

 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="wsHttpBinding" maxBufferPoolSize="524288" maxReceivedMessageSize="65536">
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:8000/" 
                      binding="wsHttpBinding" 
                      bindingConfiguration="wsHttpBinding" 
                      contract="ExpenseService.IExpenseService" 
                      name="ExpenseService" />

            <endpoint address="http://localhost:8000/" 
                      binding="wsHttpBinding" 
                      bindingConfiguration="wsHttpBinding" 
                      contract="ExpenseWorkflowService.IExpenseWorkflowService" 
                      name="wsHttpExpenseWorkflowService" />
        </client>
    </system.serviceModel>

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>

 

 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
  </configSections>


    <connectionStrings>
        <!-- CHANGE CONNECTION STRING SETTINGS HERE -->
        <add name="ExpenseEntities" connectionString="metadata=res://*/ExpenseModel.csdl|res://*/ExpenseModel.ssdl|res://*/ExpenseModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=DESME-ABC\SQLExpress;Initial Catalog=ExpenseSample;Persist Security Info=True;User ID=sa;Password=123456;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
        <add name="WorkflowStore" connectionString="server=DESME-ABC\SQLExpress;database=WorkflowInstanceStore;uid=sa;pwd=123456;" providerName="System.Data.SqlClient" />
    </connectionStrings>

  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    
    <bindings>
      <netTcpBinding>
        <binding portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>

    <services>
      <service name="ExpenseSample.Services.ExpenseService" behaviorConfiguration="serviceBehavior">

        <endpoint name="wsHttpExpenseService" 
                  address="" 
                  binding="wsHttpBinding" 
                  contract="ExpenseSample.Services.Contracts.IExpenseService" />

        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange" />

      </service>

      <!--<service name="ExpenseWorkflowService"
               behaviorConfiguration="workflowServiceBehavior">

        <endpoint name="wsHttpExpenseWorkflowService"
                  address=""
                  binding="wsHttpBinding"
                  contract="IExpenseWorkflowService"/>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8000/ExpenseWorkflowService"/>
          </baseAddresses>
        </host>
      </service>-->
    </services>

    <behaviors>
      <serviceBehaviors>

        <behavior name="workflowServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <sqlWorkflowInstanceStore connectionStringName="WorkflowStore" hostLockRenewalPeriod="00:00:05" runnableInstancesDetectionPeriod="00:00:02" instanceCompletionAction="DeleteAll" instanceLockedExceptionAction="AggressiveRetry" instanceEncodingOption="GZip" />
        </behavior>

        <behavior name="serviceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>

    </behaviors>
  </system.serviceModel>

  <!--<system.diagnostics>
		<trace autoflush="true" />
		<sources>
			<source name="System.ServiceModel"
                    switchValue="Information, ActivityTracing" 
                    propagateActivity="true">
				<listeners>
					<add name="sdt"
						type="System.Diagnostics.XmlWriterTraceListener"
						initializeData= "ExpenseService.svclog" />
				</listeners>
			</source>
		</sources>
	</system.diagnostics>-->

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
    <system.webServer>
        <handlers accessPolicy="Read, Execute, Script" />
    </system.webServer>
</configuration>

5. My web host is hosted in IIS7 and the site is configured to use .NET 4.0 and I run the web client in Cassini.

 

http://i54.tinypic.com/ifx3m1.jpg

Thanks for helping out!

Coordinator
Sep 8, 2010 at 12:26 PM

Hi,

Your client config is pointing to http://localhost:8000 only. :)

As highlighted in bullet 4, please point your address to the .svc files in the client web.config i.e.

http://localhost:8000/ExpenseWorkflowService.svc for Expense Workflow Service and http://localhost:8000/ExpenseService.svc for Expense Service.

Thanks :)

Sep 15, 2010 at 1:56 PM

OK great everything's running smoothly now but when I hit 'Submit Expense' I get the error

Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:8000/ExpenseWorkflowService.svc.  The client and service bindings may be mismatched.

Any idea what's going on?

Sep 15, 2010 at 2:27 PM

Ok I managed to fix the previous error (thanks google!) but now I get a very weird error:

An error occurred while updating the entries. See the inner exception for details.

The funny thing is, the InnerException property is always null :(

Coordinator
Sep 16, 2010 at 3:37 AM

Hi!

I noticed the following section has been commented in the Host config file:

<!--<service name="ExpenseWorkflowService"
               behaviorConfiguration="workflowServiceBehavior">

        <endpoint name="wsHttpExpenseWorkflowService"
                  address=""
                  binding="wsHttpBinding"
                  contract="IExpenseWorkflowService"/>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8000/ExpenseWorkflowService"/>
          </baseAddresses>
        </host>
      </service>-->

Make sure it is uncommented to enable the workflow service (my bad)

I am not really sure what errors you are getting. You may want to try uncommenting the diagnostics section to see what's wrong:

<!--<system.diagnostics>
		<trace autoflush="true" />
		<sources>
			<source name="System.ServiceModel"
                    switchValue="Information, ActivityTracing" 
                    propagateActivity="true">
				<listeners>
					<add name="sdt"
						type="System.Diagnostics.XmlWriterTraceListener"
						initializeData= "ExpenseService.svclog" />
				</listeners>
			</source>
		</sources>
	</system.diagnostics>-->

It will create an .svclog file and you can open it using the Service Trace Viewer that comes with VS 2010.

At the mean time, let me re-test the code that has been uploaded to the site. 

Thank You

Best Regards,
Serena