debugging Silverlight WCF RIA app; "Load operation failed for query 'GetTblProjects'. The remote server returned an error: NotFound." - wcf

Presently I am building a Silverlight WCF RIA application. It has been going well, with the client obtaining the data it needs without a problem. Then I decided to add a table to the database, update the associated Entity Data Model EDMX file, and re-generated the associated Domain Service class. Now it still gets all the tables it used to get with no problem, but when I try to obtain data from the new table tblProject, I'm receiving this error:
Error
Load operation failed for query 'GetTblProjects'. The remote server returned an error: NotFound.
Error Details
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Caused by: The remote server returned an error: NotFound.
at System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
Caused by: The remote server returned an error: NotFound.
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
Caused by: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
I've spent a lot of time looking at the domain service class, along with the XAML code and the associated view model class, and can't see any differences between the implementation related to, say, the tblBasin database table that works fine with no problems and the new tblProject table that is giving me the error. When I turn on WCF tracing, here is what I get for the tblBasin:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>458758</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-04-20T21:54:03.3280726Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{169c9eeb-338f-4ea5-a93a-34f234113283}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="5276" ThreadID="14" />
<Channel/>
<Computer>WKSTCAL0123</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en-CA/library/System.ServiceModel.Security.SecurityImpersonationSuccess.aspx</TraceIdentifier>
<Description>Security Impersonation succeeded at the server.</Description>
<AppDomain>f8f8d82-2-129794323085920534</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/SecurityImpersonationTraceRecord">
<OperationAction>http://tempuri.org/ProjectSetDomainServicebinary/GetTblBasins</OperationAction>
<OperationName>GetTblBasins</OperationName>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
Here is what I get for the tblProject table data that fails:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-04-20T21:54:03.3270721Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{30c0de8a-fd38-4ca6-8c8a-b88f27a783bf}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="5276" ThreadID="12" />
<Channel/>
<Computer>WKSTCAL0123</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en- CA/library/System.ServiceModel.Channels.MessageReceived.aspx</TraceIdentifier>
<Description>Received a message over a channel.</Description>
<AppDomain>f8f8d82-2-129794323085920534</AppDomain>
<Source>System.ServiceModel.Activation.HostedHttpContext+HostedHttpInput/61784148</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTransmitTraceRecord">
<MessageProperties>
<AllowOutputBatching>False</AllowOutputBatching>
<Via>http://localhost:57671/Services/ZEGApps-Web-Services-ProjectSetDomainService.svc/binary/GetTblProjects</Via>
</MessageProperties>
<MessageHeaders>
<To d4p1:mustUnderstand="1" xmlns:d4p1="http://schemas.microsoft.com/ws/2005/05/envelope/none" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:57671/Serv ices/ZEGApps-Web-Services-ProjectSetDomainService.svc/binary/GetTblProjects</To>
</MessageHeaders>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
Does anyone have any suggestions on how to resolve this issue? TIA.
UPDATE: All service calls are succeeding except the call to obtain data from the new tblProject database table I created.

I know this sounds pretty basic, but your question doesn't mention this information and the problem sounds very much like this could be your answer:
Have you updated the appropriate executable files on the server? If you updated only the client code with the knowledge of the new table, the server would behave this way.

Thank you so much for your reply, John!
Presently, the application is in pretty early development stages, so I am actually testing it using the Visual Studio Cassini web server. Both the client and the server projects are in the same solution. So when I rebuild the application, it should rebuild the associated XAP file, shouldn't it? This is what the timestamp for the file indicates. BTW, the SQL Server database is running on a separate database server.
Also, when I open and inspect the EDMX file, it shows the tblProject table as I expect.
If there is anything else I may have missed or you have any other suggestions, they are most welcome.

(Don't know if this still an open question...)
Have you tried using Fiddler and making your remote call ? Sometimes an error occurs on the server and an error page is returned to the client. As RIA Services handles the call, you just get a generic error message.
If your dev server is on localhost, please remember to use "localhost." (with the point) to have the call intercepted by Fiddler.

Related

Why does this web api need a local web api call to log?

I have two almost identical web api services programmed in C# and installed on the same Windows 2008 Server on IIS 6.1. When I do web api calls to them, they both work just fine. I am using log4net for logging purposes. One of them, however, does not always log. They both have the same exact log4net configuration, which is:
<log4net>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
</root>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\LOGS\SomeFolder\" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<preserveLogFileNameExtension value="true" />
<rollingStyle value="Date" />
<datePattern value="'WebApi.One.'yyyy-MM-dd'.log'" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level [%thread][%date{dd-MM-yy HH:mm:ss,fff}] %logger - %message%newline" />
</layout>
</appender>
</log4net>
The only difference in the configuration is the datePattern which has a slightly different name so that they do not log to the same exact file.
For the web api where logging works as expected a new log file is created each day as soon as a web api call comes in. For the web api where logging does not seem to work the new log file is not created. However, if I make a web api call from a browser on the same server as it is installed on, then logging starts. After the logging has started for that day it continues fine (even with web api calls coming from other machines). But the next day no new file is created.
I am unable to see what the difference is. Surely there must be something I am not thinking of that makes these two web apis behave differently when it comes to logging. Remember, both of the services work fine, it is just the logging that is not working for one of them.
Any suggestions?
Edit 1:
After adding diagnostics as suggested by Peter I can see that the access to the path is denied:
log4net:ERROR Could not create Appender [RollingLogFileAppender] of type [log4net.Appender.RollingFileAppender]. Reported error follows.
System.UnauthorizedAccessException: Access to the path 'C__LOGS_WebApi.One_' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.Mutex.CreateMutexWithGuaranteedCleanup(Boolean initiallyOwned, String name, Boolean& createdNew, SECURITY_ATTRIBUTES secAttrs)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
at log4net.Appender.RollingFileAppender.ActivateOptions()
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
log4net:ERROR Appender named [RollingLogFileAppender] not found.
I don't know why though.
Edit 2:
I checked solutions in these StackOverflow answers:
What am I doing wrong with thie log4net implementation?
log4net: Error on loading custom appender
But still no progress.
This looked very similar, but I could see no solution there (although maybe there is one).
Edit 3:
Folder permissions:
According to the exception message, the process does not have enough rights to write to the location of the log file.
In my experience with dealing with IIS, changing the security permissions on the folder where the log file is stored so that the application/process has the rights to modify the log file(s) usually works.
To confirm/troubleshoot start by giving everyone full control on the folder and testing that the file can be modified.
If that works then you can confirm it is a permission issue.
I usually give IIS_IUSRS the following permission on the Log folder where I store my logs and archive.
Read
Write
Modify
To limit possible attack vectors I try to give the process as few permission as needed to perform its function. Adding and removing permissions and then testing that it still functions as desired.
It looks like a security issue, to debug this you should enable debugging for log4net:
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
And
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\tmp\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
in your configuration.
This way you are able to see why the creation of the file fails.
log4net faq

Site published by WCF publishing wizard throws "Error in the application.."

I'm running BizTalk 2013r2 and run into a problem with the publishing wizard.
I have used the BizTalk WCF publish wizard, following the the steps:
Metadata only endpoint (MEX), publish for receive location
Publish schemas as a WCF service
Update the web service description tree view to give a single one-way web method
Give a target namespace (currently using http://tempuri.org/)
Enter location for website (is use localhost), select Overwrite existing location, Allow anonymous access
Generated service summary is below:
<?xml version="1.0" encoding="utf-16"?>
<WcfServiceDescription xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="BizTalkWcfService" TargetNamespace="http://tempuri.org/" xmlns="http://schemas.microsoft.com/BizTalk/2006/01/Adapter/Wcf/Publishing">
<LocationSettings Location="http://localhost/BTS-Store6" Overwrite="true" AuthAnonymous="true" />
<ApplicationSettings CreateReceiveLocations="false" ApplicationName="" />
<AdapterSettings AdapterName="" />
<MetadataSettings EnableMetadata="false" MetadataOnly="true" ReceiveLocationName="RcvStore6POS_WCF" />
<WcfServices>
<WcfService Name="OnRamp">
<WcfOperations>
<WcfOperation Name="POSTransaction" Flow="OneWay">
<WcfMessages>
<WcfMessage Name="Request" Direction="Input">
<WcfMessageType Category="XsdType" TypeName="BTS.GO.Store6.Schemas.BT.POSTranaction" AssemblyName="BTS.GO.Core.Store6.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0a9764041befeb8b" AssemblyLocation="C:\Windows\Microsoft.Net\assembly\GAC_MSIL\BTS.GO.Core.Store6.Schemas\v4.0_1.0.0.0__0a9764041befeb8b\BTS.GO.Core.Store6.Schemas.dll" TargetNamespace="http://BTE.ESB.StoreInputModel.POSTransaction" RootName="POS" IsAnyType="false" IsEnvelope="false" />
</WcfMessage>
</WcfMessages>
</WcfOperation>
</WcfOperations>
</WcfService>
</WcfServices>
</WcfServiceDescription>
Problem is, after publish the site, I can browse to the .svc, and use WCF storm to consume the WSD - all is good. However, after leaving it for about 30 minutes - when I next try to access the service the following error is thrown:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="System.ServiceModel 4.0.0.0"/>
<EventIDQualifiers="49154">3</EventID>
<Level>2</Level>
<Task>5</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2015-01-12T12:26:41.000000000Z"/>
<EventRecordID>293995</EventRecordID>
<Channel>Application</Channel>
<Computer>000alien004.gooutdoors.local</Computer>
<Security UserID="S-1-5-21-1638455640-2704731959-1606034848-1010"/>
</System>
<EventData>
<Data>System.ServiceModel.Activation.HostedHttpRequestAsyncResult/11812267</Data>
<Data>System.ServiceModel.ServiceActivationException: The service '/BTS-Store6/OnRamp.svc' cannot be activated due to an exception during compilation. The exception message is: Error in the application.. ---> System.ApplicationException: Error in the application. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() at Microsoft.BizTalk.Adapter.Wcf.Metadata.ConfigurationInfo.GetReceiveLocation(String receiveLocationName) at Microsoft.BizTalk.Adapter.Wcf.Metadata.MexServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) --- End of inner exception stack trace --- at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)</Data>
<Data>w3wp</Data>
<Data>21772</Data>
</EventData>
</Event>
With an exception message as vague as "Error in the application.." I'm at a loss as to what may be causing this. I have tried this many times. Usually, but not always, after republishing the site from the wizard I am able to browse to the service. The later, with semmingly only elapsed time being a changing factor, it fails.
Any ideas?

Traces.svclog in C drive

I'm using Windows 8. In drive C 's root directory (C:) there are 27 WCF Trace file; 26 of them are named like <guid>Traces.svclog and one is Traces.svclog. I'm trying to find out which applications are creating these files; because I don't have any application that uses wcf trace described here.
And here is my C:\ directory's view:
I've looked all of the traces: there are only 2 unique trace and the rest is exact copies of them. Here comes the details from one of them;
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>589828</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-10-15T06:37:57.4222685Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="Microsoft.VisualStudio.Web.Host" ProcessID="7104" ThreadID="78" />
<Channel />
<Computer>MYCOMP</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/tr-TR/library/System.ServiceModel.Activation.WebHostCompilation.aspx</TraceIdentifier>
<Description>ASP.Net hosted compilation.</Description>
<AppDomain>7f594460-3-129947566686622036</AppDomain>
<Source>System.ServiceModel.Activation.ServiceParser/17864371</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/StringTraceRecord">
<VirtualPath>/BI/DataService.svc</VirtualPath>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
So the C:\ directory is filling with rubbish traces. I've installed WCF&WF samples, and maybe that caused this. Can you help me on this; to find out which application is doing this?
Search your drive for app.config files that have systems.diagnostics sections that enable trace on the system.servicemodel tracesource.

Silverlight: Accessing SSL WCF service on nonstandard SSL port

I've made a copy of my production website for staging purposes. My Silverlight app is served on port 81, and tries to access a WCF service via SSL on port 2443. I've verified that the service is reachable by typing in the URL:
https://mydomain.com:2443/UtilService.svc -- I get the "you have created a service" page.
But when my SL app tries to execute an operation on the service, I get the famous "NotFound" exception in the End portion of my webservice client code:
{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at UtilServiceClient.UtilServiceClientChannel.EndTryAutoLogon(IAsyncResult result)
at UtilServiceClient.UtilServiceReference.IUtilService.EndTryAutoLogon(IAsyncResult result)
at UtilServiceClient.OnEndTryAutoLogon(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
I've modified clientaccesspolicy.xml as follows:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*.mydomain.com:81"/>
<domain uri="https://*.mydomain.com:2443"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Other things of note:
The production site serves an identical service on 443 without any issues
Using fiddler, I've verified that a CONNECT:2443 shows up at the right time.
I turned off the SSL requirement in IIS and modified the WCF configuration to remove Transport security, and modified the SL app to access the service on port 81 -- and it works.
I'm running IIS 6.
Is there some ju-ju I need to be able to access the service via port 2443?
Sigh. It had nothing to do with Silverlight: the problem was too-strict address filtering on the service endpoint. I added the following to my service class, and it all works:
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
I discovered this by creating a Windows client to the service, which returned much more information about the error. The moral of the story is: don't rely on Silverlight to give you the whole picture!
It might be that you need to run httpcfg to get IIS to listen for SSL traffic on port 2443.
http://msdn.microsoft.com/en-us/library/ms733768.aspx
http://technet.microsoft.com/en-us/library/cc781601(WS.10).aspx

WCF-The document was understood, but it could not be processed

I have a WCF service which i deployed on my test server. Trying to use it on my test project and I added a reference and I get this error
The document was understood, but it could not be processed.
- The WSDL document contains links that could not be resolved.
- There was an error downloading 'http://localhost:8731/somewhere.nowhere.com/service1/?xsd=xsd2'.
- Unable to connect to remote server
- No connection could be made because the target machine actively refused it
Metadata contains a reference that cannot be resolved: 'http://192.1.1.1/TestService/somewhere.nowhere.com.svc?wsdl'.
Content Type application/soap+xml; charset=utf-8 was not supported by service . The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.
I had my test app working before I added wsdlextras to my service project to include wsdl documentation.
This is the schema from my wsdl:
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd2" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd1" namespace="http://schemas.datacontract.org/2004/07/TestService"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd0" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd3" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>
Attempt to Fix 1:
I changed my
<host>
<baseAddresses>
<add baseAddress />
</baseAddresses>
</host>
so my addresses in my schema all mmatch up. I can update my service reference on my test project, however I cannot view any of my methods exposed by my wcf service.
My service is deployed on windows 2003 and my test app is on XP as well
Answer is here:
WCF IIS server configuration
in short...
The problem was with WCF identity permissions. The identity that is used for the application pool that hosts the WCF service must have full NTFS permissions on the %WINDIR%\temp folder. After changing that permission to my identity (LOCAL SERVICE) on C:\Windows\Temp I was able to add service reference to WCF service.
From the error message it looks as if it cannot find the imported xsd file xsd2.
The call to the service looks like it is on port 80, but the include files are referenced from point 8731.