Unable to allow file upload

Discussion in 'ASP.NET / ASP.NET Core' started by accruesolut, Jan 4, 2010.

  1. I want my clients to be able to upload the documents to a folder called "documents" in the root directory. what I need to know is how to give the location in the web server and what about permissions. Do we have permissions by default? The uploader works fine locally but I get a "Not Found" error every time I try to upload using the website.

    I checked some previous posts and changed the Storage Folder location to what I thought was the absolute path on the server but I'm not sure I'm using the correct path - I'm still getting "Not Found".

    The StorageFolder is set to <add key="StorageFolder" value="e:\web\accruesolut\htdocs\documents"/>

    Also, my FileReceiver is referenced using a reference to:
    client.Endpoint.Address = new System.ServiceModel.EndpointAddress(Utility.BaseUr l + "Services/FileReceiver.svc"); - do I need to change that as well and if so, to what please?

    *****************

    On Discount.asp I have the documents folder at the root of my site \documents

    FileReceiver Service as well as all of the corresponding service classes are in the Services folder at the root of my site \Services\FileReceiver.svc

    Please help, I can post my code if you like.


    Thank you,
    Gwenna
     
  2. I don't know if this helps but I ran fiddler and I get this error: HTTP/1.1 500 System.ServiceModel.ServiceActivationException

    Inner exception says: HTTP/1.1 Cache-Control Header is present: private
    private: This response MUST NOT be cached by a shared cache.
     
  3. It would help if the application can throw the actual error. Can you disable custom errors for now?
     
  4. Thank you so much for replying - sorry for the dumb question but can you please tell me how I do that? I ask you this because I don't think I have custom errors turned on...

    <!--
    The <customErrors> section enables configuration
    of what to do if/when an unhandled error occurs
    during the execution of a request. Specifically,
    it enables developers to configure html error pages
    to be displayed in place of a error stack trace.

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>
    -->

    It breaks on the BeginUpload... looks like when it tries to connect to the FileReceiver.svc / IFileReceiver. I'm wondering if there's something wrong with the link to FileReceiver in the Web.config. Am I doing this correctly for your server?

    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IFileReceiver" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
    </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
    <service behaviorConfiguration="AMS_SL3_new.Web.Services.FileReceiverBehavior"
    name="AMS_SL3_new.Web.Services.FileReceiver">
    <endpoint address="http://www.accrue-solutions.net/Services/FileReceiver.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileReceiver"
    contract="AMS_SL3_new.Web.Services.IFileReceiver">
    </endpoint>

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
    </services>
    <behaviors>
    <serviceBehaviors>
    <behavior name="AMS_SL3_new.Web.Services.FileReceiverBehavior">
    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>

    <client />
    </system.serviceModel>
     
  5. UPDATE! (after fixing many IIS7 configuration issues), I tried to access the web service through my localhost and although it does what it's supposed to in VS2008 (i.e. uploads a file), when deployed, I can't access the actual service through the browser. The error I get is: The type 'AMS_SL3_new.Web.Services.FileReceiver', provided as the Service attribute value in the ServiceHost directive could not be found.

    Stack Trace*********
    [InvalidOperationException: The type 'AMS_SL3_new.Web.Services.FileReceiver', provided as the Service attribute value in the ServiceHost directive could not be found.]
    System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +4077562
    System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +11666348
    System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +42
    System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479

    [ServiceActivationException: The service '/Services/FileReceiver.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'AMS_SL3_new.Web.Services.FileReceiver', provided as the Service attribute value in the ServiceHost directive could not be found..]
    System.ServiceModel.AsyncResult.End(IAsyncResult result) +11536522
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
    System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context) +23
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +75

    ******************************

    I researched this on the internet and checked my markup against my namespace / class name which is what the they say is the issue but that doesn't seem to be relevant in my case: Markup is:
    <%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Service="AMS_SL3_new.Web.Services.FileReceiver" %>

    Namespace (copied and pasted) AMS_SL3_new.Web.Services
    Class (copied and pasted) public class FileReceiver : IFileReceiver

    Unless I'm totally blind, this matches up!
     

Share This Page