当我尝试使用我的Web服务时,我一直找不到端点,也不知道错误在哪里,但是意识到只有Webinvoke发生了,我的Webget才能正常工作
//========================sale order barcode=======================================================
[OperationContract]
[WebInvoke(UriTemplate = "InsertSaleOrderWithBarcode", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
bool InsertSaleOrderWithBarcode(SaleOrderBarcodeEntity SaleOrder);
public bool InsertSaleOrderWithBarcode(SaleOrderBarcodeEntity SaleOrder)
{
try
{
string ItemCode = DataClass.GetItemCode(SaleOrder.BARCODE);
SaleOrderEntity newSale = new SaleOrderEntity();
newSale.CLIENTID = SaleOrder.CLIENTID;
newSale.COLOR = SaleOrder.COLOR;
newSale.DESCRIPTION = SaleOrder.DESCRIPTION;
newSale.DISCOUNT = SaleOrder.DISCOUNT;
newSale.ITEMID = int.Parse(ItemCode);
newSale.NETPRICE = SaleOrder.NETPRICE;
newSale.ORDERDATE = SaleOrder.ORDERDATE;
newSale.REFERENCE = SaleOrder.REFERENCE;
newSale.SALEORDERID = SaleOrder.SALEORDERID;
newSale.SERIES = SaleOrder.SERIES;
newSale.SIZE = SaleOrder.SIZE;
newSale.TAXCOST = SaleOrder.TAXCOST;
newSale.TOTALPRICE = SaleOrder.TOTALPRICE;
newSale.TOTALQTY = SaleOrder.TOTALQTY;
newSale.UNITPRICE = SaleOrder.UNITPRICE;
db.SaleOrders.Add(newSale);
db.SaveChanges();
return true;
}
catch (Exception ex)
{
return false;
throw new Exception(ex.Message);
}
<configSections>
<!-- For more information on Entity Framework configuration, visit http:m//go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<system.serviceModel>
<services>
<service name="ICG_ECommerce.ICGService">
<endpoint address="" behaviorConfiguration="ICG_restService" binding="webHttpBinding" contract="ICG_ECommerce.IICGService"></endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="ICG_restService">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add scheme="https" binding="basicHttpBinding" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
[Table("tblSaleOrder")]
public class SaleOrderBarcodeEntity
{
public string SERIES { get; set; }
public int SALEORDERID { get; set; }
public string BARCODE { get; set; }
public string REFERENCE { get; set; }
public string DESCRIPTION { get; set; }
public string COLOR { get; set; }
public string SIZE { get; set; }
public int TOTALQTY { get; set; }
public double UNITPRICE { get; set; }
public double DISCOUNT { get; set; }
public double TAXCOST { get; set; }
public double TOTALPRICE { get; set; }
public double NETPRICE { get; set; }
public int CLIENTID { get; set; }
public DateTime ORDERDATE { get; set; }
public long ID { get; set; }
}