.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

File protection/availability in a web service?

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

I wrote a small web service (asmx) to write stuff to a file on the server. It works fine when run in the VS2008 test container. But when I run it under IIS on a remote machine, I get:

System.IO.DirectoryNotFoundException: Could not find a part of the path 'y:\graham\misc\props.txt'.

'y' is a mounted drive on both the test and remote machines. The path really does exist. It works on the test machine; not remotely. So:

Is it the fact that 'y' is a mounted drive causing it to fail remotely? or

Is it the fact the the path lies outside of the web application directory structure? Is there something I should put in web.config??; or

Is something else the problem?

I would have thought that the service running on the server could do anything it wanted! It's not denying me access to the file; it's saying it can't find it??!!


View Complete Post

More Related Resource Links

How to set and map a Method in the Service file with endpoint elements and binding elements

Hi all, I have created a service file like OSService.svc in that i have two methods like one is FileUpload and FileDownload for e.g :- [WebInvoke(UriTemplate = "/fileupload/{fileName}" , Method = "POST" )]         [OperationContract]         void FileUpload(string fileName, Stream fileContents); same as Filedownload also. People you may know these methods are inside the interface of service file what you are using i'e i have created a interface as IOSService.cs. So, what i need now is i want to write separate endpoint for FileUpload and Filedownload.Because i want to set separate value for receiveTimeout  and openTimeout for the Fileupload and FileDownload process in binding section in the web.config file itself. The below code was i'm using right now but still i'm not able to the set separate value of endpoint elements in the bindings. EndPoint Section:- <endpoint name = "endPoint1"  address  = "localhost:8000/OSService.svc/" bindingConfiguration = "TransactionalTCP"   binding  = "netTcpBinding"          contract = "IOSService"/> Binding Section:-  <binding name = "TransactionalTCP"  transactionFlow = "true"   /&

Not able to read Config File data in Windows Service

While I'm trying to read connection string which is in App.Config file I'm getting error like "Object reference not set to an instance of an object." string strconn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString(); For the windows service where I need to keep app.config file and how to integrate that config file with the windows service exe file. Thanks in advance.

Availability of the WCF service

Hi, I'd like to monitor the health of the WCF service. But I don't want to call operations of the service. Is it possible to use Mex endpoint or something like HttpRequest to ...?wsdl to make sure the service is not down? I know that OpsMngr2007 use something  like that to measure the WWCF service health. Or is there others popular and easy methods?

What Am I doing wrong..Web service that downloads a file

Hello.. Can someone please explain to me why this web service is not liking the Response.clear , response. anything. Seems like I can't use an httpresponse inside a web service. I had this code working in a regular user control. I ported it to web service and now I ran into this. pretty much says response is not declared  Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Web.HttpResponse Imports System.IO Imports Ionic.Zip ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. <System.Web.Script.Services.ScriptService()> _ <WebService(Namespace:="http://tempuri.org/")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Public Class DownLoadUIService Inherits System.Web.Services.WebService Public currFileName As String = "" ' used if only one file needs to be added. Just send File. No need to to zip up file Public zip As ZipFile = New ZipFile ''' <summary> ''' ''' </summary> ''' <param name="xml"></param> ''' <param name="value"></param> ''' <returns></return

How to view AJAX-enabled WCF service (.svc) file in browser

Hi I have created an AJAX-enabled WCF project TestWCFAjax having Default.aspx that uses the Add.svc web service.  When I select Default.aspx and run the app in VS 2008. It works perfectly, calls the webservice to do the desired task. But, I have following questions: 1. When I select the Add.svc.cs and run through VS2008, it throws an error "The type 'TestWCFAjax.Add', provided as the Service attribute value in the ServiceHost directive could not be found.". And the web url on the browser points to http://localhost:4960/Add.svc. I didn't create any virtual directory. I tried creating one that points to my application folder - TestWCFAjax. Still it doesn't work. How can I view Add.svc service on the browser like what we can do with normal WCF service? 2. How can I use Add.svc (AJAX-enabled WCF Service) in another web application? Regards

TDE disabled and service restarted but still can't restore a new backup file

Hello, I disabled TDE on my dev database because we determined no personally identifiable info will be stored.  Disabling was done like so:Then I created a backup of MyDB database and tried to restore on a different server instance on my same machine (using SSMS) and I get  the following error: ALTER DATABASE MyDB SET ENCRYPTION OFF GO use MyDB go drop database encryption key go use master go DROP certificate DevCert GO DROP MASTER KEY GO Afterwards, I ran the following query to ensure there are no encrypted databases, and it returns zero rows: SELECT DB_NAME(database_id) AS dbname, encryption_state, case encryption_state   WHEN 0 THEN 'Unencrypted (no database encryption key present)'   WHEN 1 THEN 'Unencrypted'   WHEN 2 THEN 'Encryption in Progress'   WHEN 3 THEN 'Encrypted'   WHEN 4 THEN 'Key Change in Progress'   WHEN 5 THEN 'Decryption in Progress'   ELSE CAST(encryption_state AS varchar(20)) END AS encryption_state, key_algorithm, key_length FROM sys.dm_database_encryption_keys Then I created a backup of MyDB database and tried to restore on a different server instance on my same machine (using the SSMS) and I get the following fatal error: The media family on device 'c:\Program Files\...\Backup\TDE_removed_from_db.bak' is incorrectly formed.  SQL Server cannot process this media family. 

How to send binary data ( ogg audio file) using a web service?


Hi folks, I would appreciate any help or guidance on this topic:

How can I receive binary data (specifically an ogg audio file) using a WCF4 service?

The general idea is to define and host a WCF service inside IIS that returns an audio file (ogg file)

I have read some info related with using ByteStreamMessageEncodingBindingElement class to achieve this, also I read some topic related on using MTOM to attach a binary file. It seems that it can be several ways or approaches to achieve this.

So any guidance on the themes and/or examples for the better way to solve this point would be very appreciated.

Thanks in advance.



400 Bad Request when trying to send large file to service using basichttp streaming.


Hi All,


I am trying to send the large file (approx 1.5GB) to the WCF service for upload using basic http streaming.

I have increased all the timeouts and quotas in the server and client's config files to quite large values, but still I am getting Bad Request error on the client.


Also the Bad request message is returned always in 1 minute 30 seconds after sending the request to server.


What the most unusual thing is when I use Fiddler or Charles to debug communication, everything works fine. Is it something like fiddler is pinging the IIS or service and hence its not getting timeouted or like that?




Following are the details:

Server Config:


 <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

Log4Net with WCF Service is not writting the Log file.


Hai All,

    I have WCF Service which is hosted in IIS 7.5 and I am using Log4Net for logging errors that are raised in the WCF Service. I have all the setting configured properly in my application as per the Log4Net samples configuration. My application is working when I am using VS 2010 application server. But when I host the same Service in Windows 7 IIS 7.5 the log is being created with out any exception but there is no data in the log file.

One more thing is I have kept the Debugger in the ErrorLogger file of the Log4Net and seen all the values there, every thing is fine and I can see all the values are properly going till the last moment but in the log file nothing is present. I am unable to understand why the service is not able to write the file in the specified path which is mentioned in the web.config file.

The Log4Net settings in the Presentation Layer is as follows.

        <!--    Log4Net Appender for logging to Log file    -->
        <appender name="RollingFile" type="log4net.Appender.FileAppender">
            <file value="D:\_log\EdgeLog.log" />

XML File Protection --VB


Hi All,

I have many xml file in xmlfolder under the root director of my project. I need to protect all file to not let it open from the client browser.

My file have some credential information, and i need avoid to let it open in client browser.

Thank You

Downloading a document from a sharepoint site to local file system, copy web service returns null

Hi Guys,
               I am trying to get this done for the last 2 days and I am still banging my head to the wall.
All I need to do is to download files from my sharepoint site library that uses integrated windows authentication. I was using copy webservice : getItem method to accomplish this.

CopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);

Problem : myByteArray is always returned as NULL

Note: I have tried the same with another site that uses forms authentication but the result was the same (NULL !!)

This is my code:


Copy copy = new CopyService.Copy();


Download file from service and tracking ?? wcf help


hi all,

 Have developed a wcf download application,where the client downloads a file from the service.It also supports Resume function.Binding used is BasicHttpBinding.

I want the following in my application and need an idea on the same:-

* a folder at the service is tracked for new files or changes.A new file when in the folder,is to be sent to the client(ie downloaded).

 Now here,it is the service who needs to indicate the client when it receives  a new folder.And then the client downloads it.For this ,i will have to use HttpDuplex (callbacks).right??

But ,is HttpDuplex a better option??..will it work fine ?? has HttpDuplex has some problem with ports used and firewals and others??..I have no idea and end up guessing .!!!

Is there any other binding  that i can use,so that the service informs client about a arrival of a new file ,so that the client downloads it??

what about using net.tcp endpoint to inform the client of the new file and using BasicHttp to download file to the client?i mean 2 endpoints at service??

My criteria is the downloading should be via http and port 80.!!

Can anyone give me a clear solution..Im looking for it...do plz let me know what i can do to achieve the above..Waiting for an answer...



Mumtaz Surani

Add Service reference not updaing the client apps web.config file in .Net Framework 4.0


Hi Team

I am doing some experiments with WCF on .Net 4.0. I have created a service in 4.0 and add a new empty web application to consume my Service. When i added a service reference from the IDE, i can see the web.config file is not updated with the Servcie end points. How do i solve this issue?

My web.config in the client looks like this after adding the service reference.

is it necessary to have a config file when creating proxy of WCF service

Sign In to Vote Hi to all,

i created a service.cs file with the following code then tried to create proxy using svcutil comand.... but it gave error "not able to obtain metadata". After some web search i found i need to add a meta endpoint to the service. so i copied and pasted the code... now svcutil works and creates the proxy.cs. BUT ITS ALSO CREATED A CONFIG FILE. i want to know Do i really need this config file?? if yes then can u please describe its content to me...i will be highly thankfull to you.


using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace Service
 interface Iservice
	 string getMyDeals();

 class Service : Iservice
 public string getMyDeals()


how to send the dump file to Microsoft, is this a pay service?


Since my SQL2000 server has the "insufficient memory error 701" when doing tlog backup, it happens randomly, I applied the hotfix, increased physical memory from 2GB to 8GB with awe enabled, max server memory 6GB, it still happens sometimes when backup less than 100MB log (active log should be less than it). I tried incrase memtoleave g512 and .... whatever suggested on the forums etc. the problem still not fixed permanently.

I was suggested to dump the sql and send microsoft, but how and is there a charge?


I want a web service which will pick the data from sqldatabase and send a xml file for every row of


I want a web service which will pick the data from sqldatabase and send a xml file for every row of sql table in output folder.

i.e-if i have 5 records in database then that webservice should return 5 xml document in folder.

Is this possible?

If yes please let me know how can i do this ....

Thanks in advance


web service - xml file provision


i have created a web service that has various methods allowing a client to input product IDs to retrieve information in XML format.

the XML file gets saved to the root directory at the moment so the client will need to know the xml file name to get it via the URL.

is there a way i can prompt a download of the file when they invoke the method or display it in the browser ?

thanks for any help

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend