Hello,
I have a problem with my wcf data service.
When I'm doing a select or an insert, everything is fine.
But when I'm try an update or a delete i am refered to my local IP (something like 192.170.1.1).
Here is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
Weitere Informationen zur Konfiguration der ASP.NET-Anwendung finden Sie unter
"http://go.microsoft.com/fwlink/?LinkId=169433".
-->
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="D:\wwwroot\GnsSqlConnect\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<connectionStrings><add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=datasource;PASSWORD=password;PERSIST SECURITY INFO=True;USER ID=user"" providerName="System.Data.EntityClient" /><add name="Viarius" connectionString="metadata=res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=datasource;PASSWORD=password;PERSIST SECURITY INFO=True;USER ID=user"" providerName="System.Data.EntityClient" /></connectionStrings>
<system.web>
<httpRuntime maxRequestLength="2147483647" />
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="BasicAuthentification" type="GnsOraConnect.BasicAuthentification" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="Service1" behaviorConfiguration="myBehaviorConfig">
<endpoint address="http://myurl.com/GnsOraConnect/Service1.svc" bindingNamespace="http://myurl.com/" binding="basicHttpBinding" contract="System.Data.Services.IRequestHandler" behaviorConfiguration="WebBehavior" />
</service>
<service name="Service_Viarius" behaviorConfiguration="myBehaviorConfig">
<endpoint address="http://myurl.com/GnsOraConnect/Service_Viarius.svc" bindingNamespace="http://myurl.com/" binding="basicHttpBinding" contract="System.Data.Services.IRequestHandler" behaviorConfiguration="WebBehavior" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding maxReceivedMessageSize="655360000">
<!--<readerQuotas maxDepth="32" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="16384" />-->
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="myBehaviorConfig">
<serviceMetadata httpGetEnabled="true" httpGetUrl="" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
<!--<serviceThrottling maxConcurrentCalls="256" maxConcurrentSessions="256" maxConcurrentInstances="256" />-->
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
My Service1.svc.cs:
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
namespace GnsOraConnect
{
[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true,Namespace="http://myurl.com/")]
public class Service1 : DataService<entities>
{
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: Regeln festlegen, die angeben, welche Entitätssets und welche Dienstvorgänge sichtbar, aktualisierbar usw. sind
// Beispiele:
config.UseVerboseErrors = true;
config.SetEntitySetAccessRule("*", EntitySetRights.All);
//config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V3;
}
}
}
in my client an update:
var svcUri = new Uri("http://myurl.com/GnsOraConnect/Service_Viarius.svc/");
var ctx2 = new WcfClient3.ServiceReference2.Viarius(svcUri);
ctx2.SendingRequest +=
new EventHandler<sendingrequesteventargs>(OnSendingRequest);
var vUpdate = ctx2.DOKUMENTE.Where(v => v.LFNR == 1).FirstOrDefault();
vUpdate.DOKUMENTINFO = "Baunantrag";
vUpdate.DOKUMENTTYP = "PDF";
ctx2.UpdateObject(vUpdate);
ctx2.SaveChanges(SaveChangesOptions.ReplaceOnUpdate);
//DataServiceRequestException occurs here.
Has anyone an idea?