For future viewers, if you want to achieve this goal, in which you can add several parameters along with Stream , you need to avoid using SVC files to create a Rest or Soap service. Instead, add this to your services project, Global.asax file, the make route table, for example, for example:
public class Global : System.Web.HttpApplication { RouteTable.Routes.Add(new ServiceRoute("MyApp/rest/Photo", new WebServiceHostFactory(), typeof(PhotoComponent))); }
In your web service:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class PhotoComponent : Interfaces.IPhotoComponent { public bool UploadPhotoStream(string productid, string photoid, Stream fileData) {
inside web.config:
<services> <service behaviorConfiguration="Default" name="StackSample.Logic.PhotoComponent"> <endpoint behaviorConfiguration="JSON" binding="webHttpBinding" bindingConfiguration="RESTSecureTransfer" contract="StackSample.Interfaces.PhotoComponent" /> </service> </services>
and name it:
https://127.0.0.1/MyApp/rest/Photo/UploadPhotoStream/{productid}/{photoid}
Hope this helps.
source share